mirror of
https://github.com/Kong/insomnia.git
synced 2026-04-23 15:49:42 -04:00
31 lines
628 B
JavaScript
Executable File
31 lines
628 B
JavaScript
Executable File
var qs = require('querystring');
|
|
var http = require('http');
|
|
|
|
var options = {
|
|
method: 'POST',
|
|
hostname: 'mockbin.com',
|
|
port: null,
|
|
path: '/har?foo=bar&foo=baz&baz=abc&key=value',
|
|
headers: {
|
|
cookie: 'foo=bar; bar=baz',
|
|
accept: 'application/json',
|
|
'content-type': 'application/x-www-form-urlencoded',
|
|
},
|
|
};
|
|
|
|
var req = http.request(options, function(res) {
|
|
var chunks = [];
|
|
|
|
res.on('data', function(chunk) {
|
|
chunks.push(chunk);
|
|
});
|
|
|
|
res.on('end', function() {
|
|
var body = Buffer.concat(chunks);
|
|
console.log(body.toString());
|
|
});
|
|
});
|
|
|
|
req.write(qs.stringify({ foo: 'bar' }));
|
|
req.end();
|