0.9.1 • Published 8 years ago

http-fetcher v0.9.1

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

http-fetcher Build Status

:zap: Minimal effort for http requests

Most of the time small modules require only GET requests to function. Using full fledged packages like request in small modules can take over space in your project unnecessarily.

http-fetcher focuses only on fetching data (GET requests)

Size comparison : request >100KiB, http-fetcher <15KiB

works only for fetching data GET requests only

Install

npm install --save http-fetcher

Usage

const httpFetcher = require('http-fetcher');

httpFetcher('api.github.com', '/users/gaearon/orgs', { 'User-Agent': 'github-organizations' }, 'https')
	.then((res) => {
		console.log(res);
	});

API

get(hostname, path, headers, protocol)

Returns a promise

hostname

Type: string

Hostname for requesting resource

path

Type: string

Path for requesting resource

headers optional

Type: object

http headers

protocol

Type: string

requesting protocol (http/https)

License

MIT © Rajika Imal