node-xhr

1.0.5 • Public • Published

node-xhr

Asynchronous HTTP request utility for node, just like XMLHttpRequest.

var xhr = require('node-xhr');
 
xhr.post({
    url     : 'http://localhost:3000/v1/test',
    headers : {
        'Content-Type' : 'application/json',
    },
    params  : {
        // ...
    },
    body    : {
        // ...
    },
}, function(err, res) {
    if (err) {
        console.log(err.message);
        return;
    }
 
    console.log(JSON.stringify(res.status));
    console.log(JSON.stringify(res.headers));
    console.log(res.body);
});

Installation

You can install it by npm install node-xhr.

Documentation

About more details, please see API doc.

License

The code under The MIT License

Readme

Keywords

Package Sidebar

Install

npm i node-xhr

Weekly Downloads

246

Version

1.0.5

License

MIT

Last publish

Collaborators

  • johnsonlee