This package is similar to request-promise but uses any-promise to let the user choose which Promise library to use.
Please refer to the request-promise documentation. Everything applies to request-promise-any except the following:
- Instead of using Bluebird promises this library uses the Promise library chosen by the user.
- This library has to work with the API that all supported Promise libraries have in common. And that is the API of native ES6 promises. Mind that they have less features than Bluebird promises. In particular, the
.finally(...)method is not available.
This module is installed via npm:
npm install --save request
npm install --save request-promise-native
request is defined as a peer-dependency and thus has to be installed separately.
First, install your preferred Promise library. E.g. Q:
npm install --save q
Then, register the Promise library before you require request-promise-any for the first time:
require('any-promise/register/q')
var rp = require('request-promise-any')For a list of supported Promise libraries and advanced registration features read the documentation of any-promise.
- Go through the migration instructions to upgrade to
request-promisev4. - Ensure that you don't use Bluebird-specific features on the promise returned by your request calls. In particular, you can't use
.finally(...)anymore. - Follow the registration instructions above.
- You are done.
To set up your development environment:
- clone the repo to your desktop,
- in the shell
cdto the main folder, - hit
npm install, - hit
npm install gulp -gif you haven't installed gulp globally yet, and - run
gulp dev. (Or runnode ./node_modules/.bin/gulp devif you don't want to install gulp globally.)
gulp dev watches all source files and if you save some changes it will lint the code and execute all tests. The test coverage report can be viewed from ./coverage/lcov-report/index.html.
If you want to debug a test you should use gulp test-without-coverage to run all tests without obscuring the code by the test coverage instrumentation.
- v1.0.2 (2016-07-18)
- Fix for using with module bundlers like Webpack and Browserify
- v1.0.1 (2016-07-17)
- Fixed
@request/promise-coreversion for safer versioning
- Fixed
- v1.0.0 (2016-07-15)
- Initial version similar to
request-promisev4
- Initial version similar to
In case you never heard about the ISC license it is functionally equivalent to the MIT license.
See the LICENSE file for details.