mirror of
https://github.com/Kong/insomnia.git
synced 2026-04-22 23:28:33 -04:00
22 lines
583 B
JavaScript
Executable File
22 lines
583 B
JavaScript
Executable File
var request = require("request");
|
|
|
|
var jar = request.jar();
|
|
jar.setCookie(request.cookie("foo=bar"), "http://mockbin.com/har");
|
|
jar.setCookie(request.cookie("bar=baz"), "http://mockbin.com/har");
|
|
|
|
var options = { method: 'POST',
|
|
url: 'http://mockbin.com/har',
|
|
qs: { foo: [ 'bar', 'baz' ], baz: 'abc', key: 'value' },
|
|
headers:
|
|
{ 'content-type': 'application/x-www-form-urlencoded',
|
|
accept: 'application/json' },
|
|
form: { foo: 'bar' },
|
|
jar: 'JAR' };
|
|
|
|
request(options, function (error, response, body) {
|
|
if (error) throw new Error(error);
|
|
|
|
console.log(body);
|
|
});
|
|
|