curlconverter/test/fixtures/node-http/commented_json_with_session.js

28 lines
507 B
JavaScript

import http from 'http';
const options = {
hostname: 'localhost:28139',
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
// req.write('{ }');
req.write(JSON.stringify({}));
req.end();