hreq

1.0.1 • Public • Published

hreq

A minimal http request client.

Install

npm install hreq

Usage

The module returns a single function:

hreq = require( "hreq" )

It takes an options argument which with the same format as described for the built in Node.js https.request() function. In addition, it takes a two callback functions, the first will be called on success with the body of the response, and the second will be called with an error if there was a problem:

hreq( options[, callback_success[, callback_failure ] )

An attribute called "url" is expected to be in the options object:

options = { url: "https://google.com" }

The url is passed as the first argument to https.request() and the full options object is passed as the second argument.

hreq( options, html => {
	console.log( "Google HTML is: " + html );
}, err => {
	console.error( err );
});

Readme

Keywords

none

Package Sidebar

Install

npm i hreq

Weekly Downloads

27

Version

1.0.1

License

ISC

Unpacked Size

104 kB

Total Files

4

Last publish

Collaborators

  • sleeplessinc