It would be helpful to have the code that you've tried, but the general answer is that you can specify it in the httpheader
argument to curlPerform
. Here's a slightly modified version from the documentation:
h <- basicTextGatherer()
h$reset()
curlPerform(url,
httpheader=c('Content-Type' = "text/plain"),
postfields=toJSON(list("name" = "Smith")),
customrequest = 'POST',
writefunction = h$update,
verbose = TRUE,
ssl.verifypeer = FALSE)
body <- h$value()