ih

immutable-http

Http client with pretty simple chaining API.

Showing:

Popularity

Downloads/wk

88

GitHub Stars

10

Maintenance

Last Commit

5yrs ago

Contributors

0

Package

Dependencies

2

Size (min+gzip)

2.0KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

Immutable-http

npm version Build Status

Http client with pretty simple chaining API

Docs

Usage

import executor from 'third-party-executor'

var result = new Http().url('http://any_api.com/:id')
                        .executor(executor)
                        .method('GET')
                        .header('Content-Type','application/json')
                        .body({some:data})
                        .responseType('json')
                        .segment('id',123)
                        .query('filter','some_filter') // Adds query section for the url like '?filter=some_filter'
                        .exec(); // returns Promise

executor is just a function with signature

f(url: String, method: String, headers:Array[Tuple[String, String]], responseType: String, body: Any): Promise

It allows you to have your own favorite HTTP library under the hood and be able to test your code with mocked executor without any hacks. Executor implementation example

Build

npm run dist

Tests

Run

npm test

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100