Http client with pretty simple chaining API
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
Using Babel
babel --optional runtime src/immutable-http.es6 --out-file lib/immutable-http.js
Run
node server
then
npm test
Built on Jest