Send URL-encoded parameters in Node.js using request module
Rename the qs
key to form
in the object. The qs
key is for specifying the query string on the end of the URL (e.g. For GET requests). The form
key is for specifying the form URL encoded request body (e.g. For a POST request).
the same issue for me and my resolution which is perfectly working for me is.
request.post({
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
url : "http://pastebin.com/api/api_post.php",
body : "api_dev_key=MY_DEV_KEY&api_option=paste&api_paste_code=andom text"},function(err,res,body){ ...});