2.0.1 • Published 9 years ago
hello-http v2.0.1
hello
A node http.request wrapper with some sugar like url, data and json parsing.
install
$ npm i hello-httpapi
simple remote request
hello(method, url [, data], cb)
method string
url string
data object stringified to json by default and appropriate headers set. Optional
custom remote request or localhost
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.
cb(err, res)
err null or an error message
res.raw unparsed response. Includes headers and statuscodes.
res.data parsed json by default. Otherwise the body string.
test
$ npm testTodos
- tests
- npm
- use on gaston
licence
MIT