Skip to content

Commit c63e3a3

Browse files
committed
Version 4.1.0
1 parent 54d27f6 commit c63e3a3

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ Consider Request-Promise being:
213213
- `rp(...).then(...)` or e.g. `rp.post(...).then(...)` which turn `rp(...)` and `rp.post(...)` into promises
214214
- `rp(...).catch(...)` or e.g. `rp.del(...).catch(...)` which is the same method as provided by Bluebird promises
215215
- `rp(...).finally(...)` or e.g. `rp.put(...).finally(...)` which is the same method as provided by Bluebird promises
216+
- `rp(...).cancel()` or e.g. `rp.get(...).cancel()` which cancels the request
216217
- `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)
217218
- Plus some additional options:
218219
- `simple = true` which is a boolean to set whether status codes other than 2xx should also reject the promise
@@ -286,6 +287,15 @@ rp('http://google.com')
286287
});
287288
```
288289

290+
### .cancel()
291+
292+
This method cancels the request using [Bluebird's cancellation feature](http://bluebirdjs.com/docs/api/cancellation.html).
293+
294+
When `.cancel()` is called:
295+
296+
- the promise will neither be resolved nor rejected and
297+
- the request is [aborted](https://nodejs.org/dist/latest-v6.x/docs/api/http.html#http_request_abort).
298+
289299
### .promise() - For advanced use cases
290300

291301
In order to not pollute the Request call objects with the methods of the underlying Bluebird promise, only `.then(...)`, `.catch(...)`, and `.finally(...)` were exposed to cover most use cases. The effect is that any methods of a Bluebird promise other than `.then(...)`, `.catch(...)`, or `.finally(...)` cannot be used as the **FIRST** method in the promise chain:
@@ -568,6 +578,9 @@ If you want to debug a test you should use `gulp test-without-coverage` to run a
568578

569579
## Change History
570580

581+
- v4.1.0 (2016-07-30)
582+
- Added cancellation support
583+
*(Thanks to @not-an-aardvark for [pull request #123](https://github.com/request/request-promise/pull/123))*
571584
- v4.0.2 (2016-07-18)
572585
- Fix for using with module bundlers like Webpack and Browserify
573586
- v4.0.1 (2016-07-17)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "request-promise",
3-
"version": "4.0.2",
3+
"version": "4.1.0",
44
"description": "The simplified HTTP request client 'request' with Promise support. Powered by Bluebird.",
55
"keywords": [
66
"xhr",

0 commit comments

Comments
 (0)