http-sync
http-sync copied to clipboard
POST request not working as expected
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?