Just remember set method to POST in options. Here is my code
var options = {
url: 'http://www.example.com',
method: 'POST', // Don't forget this line
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'X-MicrosoftAjax': 'Delta=true', // blah, blah, blah...
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36',
},
form: {
'key-1':'value-1',
'key-2':'value-2',
...
}
};
//console.log('options:', options);
// Create request to get data
request(options, (err, response, body) => {
if (err) {
//console.log(err);
} else {
console.log('body:', body);
}
});