A node http.request wrapper with some sugar like url
, data
and json parsing.
$ npm i hello-http
hello(method, url [, data], cb)
method
string
url
string
data
object stringified to json by default and appropriate headers set. Optional
hello({method, hostname, headers [, port, path, data]}, cb)
method
string
hostname
string defaults to localhost
port
number Required if requesting localhost
. Defaults to 80
path
string Defaults to /
data
object or string. Parsed as json or urlencoded and appropriate headers set. Optional
headers
object Will be empty unless data
is set.
All options in the original api is supported.
err
null or an error message
res.raw
unparsed response. Includes headers and statuscodes.
res.data
parsed json by default. Otherwise the body string.
$ npm test
- [x] tests
- [x] npm
- use on gaston
MIT