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);
});
Also in JavaScript:
- call javascript function from php
- filter in react native
- how to show progress on ajax call
- match ids from 2 arrays in javascript asynchronous programming
- uppercase string in js
- cesar ciupher js
- jquery on click get element
- how to convert entered number into currency in words in javascript
- remove whitespace with regex javascript
- get year javascript copyright
- javascript var
- select the items from selectors in .map reactjs
- javascript modify url without reloading page
- mobile nav react npm
- js array get range
- camelcase to hyphenated javascript
- js check if object is empty
- jquery toggle attribute disabled
- how to log something in the console. javascript
- react cam filters
- Done button press event ReactJS keyboard PWA
- print("Google") in JavaScript
- javascript get domain
- slick js's alternatives