request-f
v1.0.0
Published
request library wrapped into fluture library
Downloads
7
Maintainers
Readme
request-f
Fantasy Land Future compatible request library based on request, fluture and sancturay.
Methods
Every methods have next signature.
<methodName> :: String s -> Future a s
<methodName> :: RequestOptions o -> Future a o
List of RequestOptions see here
Examples
Simple example
const requestF = require('request-f');
requestF
.get('http://site.com')
.fork(console.error, console.log);
// -> Right({ body: '...', statusCode: '...', headers: { ... } })
Using with Sanctuary
const { create, env } = require('sanctuary');
const { env: flutureEnv } = require('fluture-sanctuary-types');
const S = create({
checkTypes: true,
env: env.concat(flutureEnv),
});
const getBody = S.map(S.prop('body'));
requestF
.get('http://site.com')
.map(getBody)
.fork(console.error, console.log);
// -> Right('<body value>')
Learn more about integration fluture with sanctuary
MIT License