I used the npm package queryString and did something like this:
var formdata=queryString.stringify({
SOMEDATA: SOMEVALUE,
MOREDATA: MOREVALUE
});
var options={
hostname: <hostname>,
path: <path>
method: 'POST',
headers:{
'Content-Type':'application/x-www-form-urlencoded',
'Content-Length': formdata.length
}
}
let request = https.request(options,function(response){
//do something with the response data here
}
request.write(formdata);
request.end();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.