1.1.0 • Published 7 years ago

bellmounte-http-request v1.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

http-request

A Promise wrapper around the native node http.request and https.request methods.

Usage

const options = {
    hostname: 'example.com',
    port: 80,
    path: '/api',
    method: 'POST',
};
const data = JSON.stringify({
    sample: 'test'
});

httpRequest(options, data).then((response) => {
    console.log({response});
}).catch((error) => {
    console.error({error});
});

Note: options follows the nodejs's method for http.request.

Additional Options
  • followAllRedirects - Follows redirects from http status code 301.
1.1.0

7 years ago

1.0.0

8 years ago