@quenk/jhr
v2.7.6
Published
HTTP agent library.
Downloads
38
Readme
JHR
Introduction
This is library for making XHR/HTTP requests from web applications and Node.js It's APIs are designed around the Quenk Noni library.
Installation
npm install --save @quenk/jhr
Usage
import {doFuture} from '@quenk/noni/lib/control/monad/future';
import {createAgent} from '@quenk/jhr/lib/browser';
let agent = createAgent();
doFuture(function *() {
let res1 = yield agent.get('/');
let res2 = yield agent.post('/', {name:'User', token: res1.body.token});
if(res2.status === 200)
return pure(undefined);
else
return raise(new Error('Request failed!'));
}).fork(console.error, ()=>{});
See the API documentation for more information.
License
This module contains parts licensed under the BSD 3 clause license as well as the Apache-2.0 license. Please see the LICENSE file for more details.
© Quenk Technologies Limited and respective authors.