mirror of
https://github.com/Kong/insomnia.git
synced 2026-10-27 17:19:42 -04:00
32 lines
448 B
JavaScript
Executable File
32 lines
448 B
JavaScript
Executable File
var unirest = require('unirest');
|
|
|
|
var req = unirest('POST', 'http://mockbin.com/har');
|
|
|
|
req.headers({
|
|
'content-type': 'application/json',
|
|
});
|
|
|
|
req.type('json');
|
|
req.send({
|
|
number: 1,
|
|
string: 'f"oo',
|
|
arr: [1, 2, 3],
|
|
nested: {
|
|
a: 'b',
|
|
},
|
|
arr_mix: [
|
|
1,
|
|
'a',
|
|
{
|
|
arr_mix_nested: {},
|
|
},
|
|
],
|
|
boolean: false,
|
|
});
|
|
|
|
req.end(function(res) {
|
|
if (res.error) throw new Error(res.error);
|
|
|
|
console.log(res.body);
|
|
});
|