I am trying to do the following cUrl request in node.js using either request or http/https(or anything else if its not possible with those 2)
curl -k -3 -X POST https://somedomain.com/rest/ \
-H "customeHeader: customeHeader" \ // customer header
-d '{ "email" : "foo@bar.com", "password" : "yourpassword" }' // data to post.
this is what i got so far:
var options = {
"hostname": "https://somedomain.com/rest/",
"method": 'POST',
"headers" : {
"customeHeader" : "customeHeader"
},
"secureProtocol" : "SSLv3_method",
"rejectUnauthorized" : false
};
var req = https.request(options, function(res) {
res.on('data', function(d) {
console.log(d);
//process.stdout.write(d);
});
});
req.end();
req.on('error', function(e) {
console.error(e);
});
}
I think I'm only missing the Post fields(-d) or is the above completely wrong