UNPKG

httpsnippet

Version:

HTTP Request snippet generator for *most* languages

16 lines (15 loc) 336 B
"use strict"; var unirest = require('unirest'); var req = unirest('POST', 'http://mockbin.com/har'); req.headers({ 'content-type': 'application/x-www-form-urlencoded' }); req.form({ foo: 'bar', hello: 'world' }); req.end(function (res) { if (res.error) throw new Error(res.error); console.log(res.body); });