whats the request body in javascript code example
Example: how to create request body javascript
var querystring = require('querystring');
var https = require('https');
var postData = {
'Value1' : 'abc1',
'Value2' : 'abc2',
'Value3' : '3'
};
var postBody = querystring.stringify(postData);
var options = {
host: 'URL'
port: 443,
path: 'PATH'
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': postBody.length
}
};
var req = https.request(options, function(res) {
console.log(res.statusCode);
res.on('data', function(d) {
process.stdout.write(d);
});
});
req.write(postBody);
req.end();
req.on('error', function(e) {
console.error(e);
});