yarp
1.0.0 • Public • Published YARP (Yet Another Request-Promise)

There is a glut of promise-based wrappers around the awesome request
module (https://github.com/request/request).
This is yet another one.
Overly Simple:
var yarp = require('yarp');
yarp({
method: 'GET',
url: 'http://jsonplaceholder.typicode.com/users',
}).then(function(resp){
console.log(resp);
}).catch(function(err){
if(err.statusCode) {
console.log(err.statusCode);
console.log(err.message);
console.log(err.data);
console.log(err.request);
} else {
console.log(err)
}
}).done();
As of 0.4.0, you can now pass true
as a second parameter to have all responses treated as resolution:
var yarp = require('yarp');
yarp({
method: 'GET',
url: 'http://jsonplaceholder.typicode.com/users',
}, true).then(function(resp){
console.log(resp.statusCode);
console.log(resp.data)
console.log(resp.body)
}).catch(function(err){
console.log(err)
}).done();
Package Sidebar
Install
Weekly Downloads