Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

node-http

shallker13.7kMIT0.0.5

node-http.

node-http

readme

node-http

Unify http interface in Node.

Installation

npm install node-http

API

var NodeHttp = require('node-http');
var nodeHttp = new Http;

.url(String address)

.header(String name, String value)

.data(Mix data)

.method(String name)

.on(String event, Function callback)

.off(String event, Function callback)

.complete(Function callback)

.success(Function callback)

.fail(Function callback)

.GET(String address, [Function onComplete], [Function onError])

.POST(String address, Mix data, [Function onComplete], [Function onError])

.request(Object options, [Function onComplete], [Function onError])

Events

'complete'

'success'

'fail'

'buffer'

nodeHttp.on('buffer', function (buffer) {

});

'responseText'

nodeHttp.on('responseText', function (responseText) {

});


#### status code
```javascript
nodeHttp.on(200, function (response) {

});

status name

nodeHttp.on('Ok', function (response) {

});

nodeHttp.on('Not Found', function (response) {

});

License

MIT