request-promise
Advanced tools
Comparing version 4.0.2 to 4.1.0
'use strict'; | ||
var Bluebird = require('bluebird'), | ||
var Bluebird = require('bluebird').getNewLibraryCopy(), | ||
configure = require('@request/promise-core/configure/request2'), | ||
@@ -23,2 +23,3 @@ stealthyRequire = require('stealthy-require'); | ||
Bluebird.config({cancellation: true}); | ||
@@ -32,7 +33,13 @@ configure({ | ||
'finally', | ||
'cancel', | ||
'promise' | ||
] | ||
], | ||
constructorMixin: function (resolve, reject, onCancel) { | ||
var self = this; | ||
onCancel(function () { | ||
self.abort(); | ||
}); | ||
} | ||
}); | ||
request.bindCLS = function RP$bindCLS() { | ||
@@ -39,0 +46,0 @@ throw new Error('CLS support was dropped. To get it back read: https://github.com/request/request-promise/wiki/Getting-Back-Support-for-Continuation-Local-Storage'); |
{ | ||
"name": "request-promise", | ||
"version": "4.0.2", | ||
"version": "4.1.0", | ||
"description": "The simplified HTTP request client 'request' with Promise support. Powered by Bluebird.", | ||
@@ -36,3 +36,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@request/promise-core": "1.0.0", | ||
"@request/promise-core": "1.1.0", | ||
"bluebird": "^3.4.1", | ||
@@ -39,0 +39,0 @@ "stealthy-require": "^1.0.0" |
@@ -26,4 +26,5 @@ <a href="http://promisesaplus.com/"> | ||
1. `request` became a peer dependency. Thus make sure that `request` is installed into your project as a direct dependency. (`npm install --save request`) | ||
2. Continuation Local Storage is no longer supported. However, you [can get back the support](https://github.com/request/request-promise/wiki/Getting-Back-Support-for-Continuation-Local-Storage) by using `request-promise-any`. | ||
3. When you migrated your `transform` function to v3 and had to add `if (!(/^2/.test('' + response.statusCode))) { return resolveWithFullResponse ? response : body; }` you may now set the option `transform2xxOnly = true` instead. | ||
2. **Note for NPM proxy users:** `request-promise` depends on `@request/promise-core` and downloading such [scoped packages](https://www.npmjs.org/doc/misc/npm-scope.html) seems to be a bit of a challenge for NPM proxies like [`sinopia`](https://github.com/rlidwka/sinopia) or [Artifactory](https://www.jfrog.com/artifactory/). If your `npm install` results in a 404 please read [this issue](https://github.com/request/request-promise/issues/137). | ||
3. Continuation Local Storage is no longer supported. However, you [can get back the support](https://github.com/request/request-promise/wiki/Getting-Back-Support-for-Continuation-Local-Storage) by using `request-promise-any`. | ||
4. When you migrated your `transform` function to v3 and had to add `if (!(/^2/.test('' + response.statusCode))) { return resolveWithFullResponse ? response : body; }` you may now set the option `transform2xxOnly = true` instead. | ||
@@ -51,2 +52,4 @@ ## Migration from v2 to v3 | ||
**Note for NPM proxy users:** `request-promise` depends on `@request/promise-core` and downloading such [scoped packages](https://www.npmjs.org/doc/misc/npm-scope.html) seems to be a bit of a challenge for NPM proxies like [`sinopia`](https://github.com/rlidwka/sinopia) or [Artifactory](https://www.jfrog.com/artifactory/). If your `npm install` results in a 404 please read [this issue](https://github.com/request/request-promise/issues/137). | ||
## Cheat Sheet | ||
@@ -215,2 +218,3 @@ | ||
- `rp(...).finally(...)` or e.g. `rp.put(...).finally(...)` which is the same method as provided by Bluebird promises | ||
- `rp(...).cancel()` or e.g. `rp.get(...).cancel()` which cancels the request | ||
- `rp(...).promise()` or e.g. `rp.head(...).promise()` which returns the underlying promise so you can access the full [Bluebird API](https://github.com/petkaantonov/bluebird/blob/master/API.md) | ||
@@ -289,2 +293,11 @@ - Plus some additional options: | ||
### .cancel() | ||
This method cancels the request using [Bluebird's cancellation feature](http://bluebirdjs.com/docs/api/cancellation.html). | ||
When `.cancel()` is called: | ||
- the promise will neither be resolved nor rejected and | ||
- the request is [aborted](https://nodejs.org/dist/latest-v6.x/docs/api/http.html#http_request_abort). | ||
### .promise() - For advanced use cases | ||
@@ -572,2 +585,5 @@ | ||
- v4.1.0 (2016-07-30) | ||
- Added cancellation support | ||
*(Thanks to @not-an-aardvark for [pull request #123](https://github.com/request/request-promise/pull/123))* | ||
- v4.0.2 (2016-07-18) | ||
@@ -574,0 +590,0 @@ - Fix for using with module bundlers like Webpack and Browserify |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33185
41
660
+ Added@request/promise-core@1.1.0(transitive)
- Removed@request/promise-core@1.0.0(transitive)
Updated@request/promise-core@1.1.0