$ npm install prequest
With this wrapper, we can easily make requests and catch any http failures in a promise's catch. By default, method is
var prequest = ;;
If you need the full response (e.g. to view headers), specify
arrayResponse: true to have the response and body in an array. You may use bluebird's
spread to access the items directly:
All options supported by
request can be supplied to prequest.
json: true is enabled to set body payload as a JSON representation. If you do not want this, simply override it to false.
var prequest = ;console;);
To use the other methods: [delete, patch, head], specify it in method.
To run the tests:
$ npm install $ npm test
The past, without prequest
Without this wrapper, a common pattern to
var Promise = ;var prequest = Promise;
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -m 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D