mirror of
https://github.com/tenrok/axios.git
synced 2026-06-17 19:21:29 +03:00
Release/v0.22.0 (#4107)
* fix/Avoid package.json import; (#4041) * Added auto-generated config module `env/data.js` for importing package environment vars without importing the whole `package.json`; Refactored `http.js` to use `env/data.js` instead of package.json; * Added `env/data.js`; Added `env/README.md`; * Feat/export package version constant (#4065) * Added auto-generated config module `env/data.js` for importing package environment vars without importing the whole `package.json`; Refactored `http.js` to use `env/data.js` instead of package.json; * Added `env/data.js`; Added `env/README.md`; * Export package version constant; * Fixed cancelToken leakage; Added AbortController support; (#3305) * Fixed cancelToken leakage; Added AbortController support; * Fixed typings; * Documented `signal` option; * Added processing of early cancellation using AbortController without sending a request; Co-authored-by: Jay <jasonsaayman@gmail.com> * Updating CI to run on release branches * Fixed default transitional config for custom Axios instance; (#4052) Refactored `/core/mergeConfig`; Co-authored-by: Jay <jasonsaayman@gmail.com> * Prepping v0.22.0 for release * Updated date Co-authored-by: Dmitriy Mozgovoy <robotshara@gmail.com>
This commit is contained in:
@@ -452,6 +452,9 @@ These are the available config options for making requests. Only the `url` is re
|
||||
cancelToken: new CancelToken(function (cancel) {
|
||||
}),
|
||||
|
||||
// an alternative way to cancel Axios requests using AbortController
|
||||
signal: new AbortController().signal,
|
||||
|
||||
// `decompress` indicates whether or not the response body should be decompressed
|
||||
// automatically. If set to `true` will also remove the 'content-encoding' header
|
||||
// from the responses objects of all decompressed responses
|
||||
@@ -734,7 +737,20 @@ axios.get('/user/12345', {
|
||||
cancel();
|
||||
```
|
||||
|
||||
> Note: you can cancel several requests with the same cancel token.
|
||||
Axios supports AbortController to abort requests in [`fetch API`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API#aborting_a_fetch) way:
|
||||
```js
|
||||
const controller = new AbortController();
|
||||
|
||||
axios.get('/foo/bar', {
|
||||
signal: controller.signal
|
||||
}).then(function(response) {
|
||||
//...
|
||||
});
|
||||
// cancel the request
|
||||
controller.abort()
|
||||
```
|
||||
|
||||
> Note: you can cancel several requests with the same cancel token/abort controller.
|
||||
> If a cancellation token is already cancelled at the moment of starting an Axios request, then the request is cancelled immediately, without any attempts to make real request.
|
||||
|
||||
## Using application/x-www-form-urlencoded format
|
||||
|
||||
Reference in New Issue
Block a user