Skip to content

Latest commit

 

History

History
50 lines (41 loc) · 1.16 KB

README.md

File metadata and controls

50 lines (41 loc) · 1.16 KB

Immutable-http

npm version

Http client with pretty simple chaining API

Usage

var result = new Http().withUrl('http://any_api.com/:id')
                        .withMethod('GET')
                        .withHeader('Content-Type','application/json')
                        .withBody({some:data})
                        .withResponseType('json')
                        .withDynamicSegment('id',123)
                        .withParam('filter','some_filter') // Adds query section to the url like '?filter=some_filter'
                        .exec();
result = Promise({
  status: int,
  response: [obj|string],
  headers: string
}, {
  status: int,
  response: [obj|string],
  headers: string
})

Response type options could be obtained from XMLHttp specs

Build

Using Babel

babel --optional runtime src/immutable-http.es6 --out-file lib/immutable-http.js

Tests

Run

node server

then

npm test

Built on Jest