Reputation: 301
I want to do a POST request which contains a body, I did that with postman but I failed to write that in node.js after many attempts. Here is a screen in postman which shows the request :
(fixed)
Thanks !
Upvotes: 0
Views: 61
Reputation: 11704
I think you can try to send the data doing:
req.write(data);
req.end();
You also need to declare the Content-Length value
'Content-Length': Buffer.byteLength(data)
I haven't actually tried it, but usually I send post data this way. Hope this could help.
Upvotes: 1