http-sync icon indicating copy to clipboard operation
http-sync copied to clipboard

POST request not working as expected

Open rikem opened this issue 9 years ago • 0 comments

Sending POST requests produces weird errors. My request looks like this:

var url = format("/data/update?private_token={privateToken}", {
   privateToken: params.privateToken
})
var req = httpSync.request({
  method: "POST",
  host: config.remoteService.bind,
  port: config.remoteService.port,
  path: url,
  body: {q: someString}
})
req.end()

I had expected http-request to send a POST request with {q: "Example Text"} as body. But the consuming service receives the following request:

POST /data/update?private_token=someSecretToken
  Body: {"object Object"=>nil, "private_token"=>"someSecretToken"}

What am I doing wrong?

rikem avatar Dec 17 '15 10:12 rikem