request-promise-json
Thin wrapper around request module to provide simple JSON API with q promises. All methods return promise resolving to json object.
Install
npm install request-promise-json --save
Usage:
var http = ; ; // or use shortcuts:http;http;http; // or provide options object directy to 'request' library // (see docs for 'request' module https://www.npmjs.com/package/request):http;
Error Handling:
If request fails with an error, promise will be rejected with that error.
If response status code is >= 400, reject Error will have following properties:
- statusCode
- request - request options (method, url, body)
- response - response body
// Example of error handling:http;