axios 0.21.4 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +117 -1
- package/README.md +43 -3
- package/UPGRADE_GUIDE.md +6 -0
- package/dist/axios.js +189 -105
- package/dist/axios.map +1 -1
- package/dist/axios.min.js +3 -2
- package/dist/axios.min.map +1 -1
- package/index.d.ts +92 -39
- package/lib/adapters/http.js +78 -21
- package/lib/adapters/xhr.js +32 -9
- package/lib/axios.js +6 -5
- package/lib/cancel/CancelToken.js +62 -0
- package/lib/core/Axios.js +15 -8
- package/lib/core/dispatchRequest.js +5 -0
- package/lib/core/enhanceError.js +2 -1
- package/lib/core/mergeConfig.js +50 -38
- package/lib/defaults.js +6 -6
- package/lib/env/README.md +3 -0
- package/lib/env/data.js +3 -0
- package/lib/helpers/isAbsoluteURL.js +1 -1
- package/lib/helpers/isAxiosError.js +3 -1
- package/lib/helpers/toFormData.js +55 -0
- package/lib/helpers/validator.js +7 -30
- package/lib/utils.js +4 -4
- package/package.json +8 -6
- package/tsconfig.json +14 -0
- package/tslint.json +6 -0
package/CHANGELOG.md
CHANGED
@@ -1,9 +1,125 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
### 0.25.0 (January 18, 2022)
|
4
|
+
|
5
|
+
Breaking changes:
|
6
|
+
- Fixing maxBodyLength enforcement ([#3786](https://github.com/axios/axios/pull/3786))
|
7
|
+
- Don't rely on strict mode behaviour for arguments ([#3470](https://github.com/axios/axios/pull/3470))
|
8
|
+
- Adding error handling when missing url ([#3791](https://github.com/axios/axios/pull/3791))
|
9
|
+
- Update isAbsoluteURL.js removing escaping of non-special characters ([#3809](https://github.com/axios/axios/pull/3809))
|
10
|
+
- Use native Array.isArray() in utils.js ([#3836](https://github.com/axios/axios/pull/3836))
|
11
|
+
- Adding error handling inside stream end callback ([#3967](https://github.com/axios/axios/pull/3967))
|
12
|
+
|
13
|
+
Fixes and Functionality:
|
14
|
+
- Added aborted even handler ([#3916](https://github.com/axios/axios/pull/3916))
|
15
|
+
- Header types expanded allowing `boolean` and `number` types ([#4144](https://github.com/axios/axios/pull/4144))
|
16
|
+
- Fix cancel signature allowing cancel message to be `undefined` ([#3153](https://github.com/axios/axios/pull/3153))
|
17
|
+
- Updated type checks to be formulated better ([#3342](https://github.com/axios/axios/pull/3342))
|
18
|
+
- Avoid unnecessary buffer allocations ([#3321](https://github.com/axios/axios/pull/3321))
|
19
|
+
- Adding a socket handler to keep TCP connection live when processing long living requests ([#3422](https://github.com/axios/axios/pull/3422))
|
20
|
+
- Added toFormData helper function ([#3757](https://github.com/axios/axios/pull/3757))
|
21
|
+
- Adding responseEncoding prop type in AxiosRequestConfig ([#3918](https://github.com/axios/axios/pull/3918))
|
22
|
+
|
23
|
+
Internal and Tests:
|
24
|
+
- Adding axios-test-instance to ecosystem ([#3786](https://github.com/axios/axios/pull/3786))
|
25
|
+
- Optimize the logic of isAxiosError ([#3546](https://github.com/axios/axios/pull/3546))
|
26
|
+
- Add tests and documentation to display how multiple inceptors work ([#3564](https://github.com/axios/axios/pull/3564))
|
27
|
+
- Updating follow-redirects to version 1.14.7 ([#4379](https://github.com/axios/axios/pull/4379))
|
28
|
+
|
29
|
+
|
30
|
+
Documentation:
|
31
|
+
- Fixing changelog to show corrext pull request ([#4219](https://github.com/axios/axios/pull/4219))
|
32
|
+
- Update upgrade guide for https proxy setting ([#3604](https://github.com/axios/axios/pull/3604))
|
33
|
+
|
34
|
+
Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:
|
35
|
+
|
36
|
+
- [Jay](mailto:jasonsaayman@gmail.com)
|
37
|
+
- [Rijk van Zanten](https://github.com/rijkvanzanten)
|
38
|
+
- [Kohta Ito](https://github.com/koh110)
|
39
|
+
- [Brandon Faulkner](https://github.com/bfaulk96)
|
40
|
+
- [Stefano Magni](https://github.com/NoriSte)
|
41
|
+
- [enofan](https://github.com/fanguangyi)
|
42
|
+
- [Andrey Pechkurov](https://github.com/puzpuzpuz)
|
43
|
+
- [Doowonee](https://github.com/doowonee)
|
44
|
+
- [Emil Broman](https://github.com/emilbroman-eqt)
|
45
|
+
- [Remco Haszing](https://github.com/remcohaszing)
|
46
|
+
- [Black-Hole](https://github.com/BlackHole1)
|
47
|
+
- [Wolfram Kriesing](https://github.com/wolframkriesing)
|
48
|
+
- [Andrew Ovens](https://github.com/repl-andrew-ovens)
|
49
|
+
- [Paulo Renato](https://github.com/PauloRSF)
|
50
|
+
- [Ben Carp](https://github.com/carpben)
|
51
|
+
- [Hirotaka Tagawa](https://github.com/wafuwafu13)
|
52
|
+
- [狼族小狈](https://github.com/lzxb)
|
53
|
+
- [C. Lewis](https://github.com/ctjlewis)
|
54
|
+
- [Felipe Carvalho](https://github.com/FCarvalhoVII)
|
55
|
+
- [Daniel](https://github.com/djs113)
|
56
|
+
- [Gustavo Sales](https://github.com/gussalesdev)
|
57
|
+
|
58
|
+
### 0.24.0 (October 25, 2021)
|
59
|
+
|
60
|
+
Breaking changes:
|
61
|
+
- Revert: change type of AxiosResponse to any, please read lengthy discussion here: ([#4141](https://github.com/axios/axios/issues/4141)) pull request: ([#4186](https://github.com/axios/axios/pull/4186))
|
62
|
+
|
63
|
+
Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:
|
64
|
+
|
65
|
+
- [Jay](mailto:jasonsaayman@gmail.com)
|
66
|
+
- [Rodry](https://github.com/ImRodry)
|
67
|
+
- [Remco Haszing](https://github.com/remcohaszing)
|
68
|
+
- [Isaiah Thomason](https://github.com/ITenthusiasm)
|
69
|
+
|
70
|
+
### 0.23.0 (October 12, 2021)
|
71
|
+
|
72
|
+
Breaking changes:
|
73
|
+
- Distinguish request and response data types ([#4116](https://github.com/axios/axios/pull/4116))
|
74
|
+
- Change never type to unknown ([#4142](https://github.com/axios/axios/pull/4142))
|
75
|
+
- Fixed TransitionalOptions typings ([#4147](https://github.com/axios/axios/pull/4147))
|
76
|
+
|
77
|
+
Fixes and Functionality:
|
78
|
+
- Adding globalObject: 'this' to webpack config ([#3176](https://github.com/axios/axios/pull/3176))
|
79
|
+
- Adding insecureHTTPParser type to AxiosRequestConfig ([#4066](https://github.com/axios/axios/pull/4066))
|
80
|
+
- Fix missing semicolon in typings ([#4115](https://github.com/axios/axios/pull/4115))
|
81
|
+
- Fix response headers types ([#4136](https://github.com/axios/axios/pull/4136))
|
82
|
+
|
83
|
+
Internal and Tests:
|
84
|
+
- Improve timeout error when timeout is browser default ([#3209](https://github.com/axios/axios/pull/3209))
|
85
|
+
- Fix node version on CI ([#4069](https://github.com/axios/axios/pull/4069))
|
86
|
+
- Added testing to TypeScript portion of project ([#4140](https://github.com/axios/axios/pull/4140))
|
87
|
+
|
88
|
+
Documentation:
|
89
|
+
- Rename Angular to AngularJS ([#4114](https://github.com/axios/axios/pull/4114))
|
90
|
+
|
91
|
+
Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:
|
92
|
+
|
93
|
+
- [Jay](mailto:jasonsaayman@gmail.com)
|
94
|
+
- [Evan-Finkelstein](https://github.com/Evan-Finkelstein)
|
95
|
+
- [Paweł Szymański](https://github.com/Jezorko)
|
96
|
+
- [Dobes Vandermeer](https://github.com/dobesv)
|
97
|
+
- [Claas Augner](https://github.com/caugner)
|
98
|
+
- [Remco Haszing](https://github.com/remcohaszing)
|
99
|
+
- [Evgeniy](https://github.com/egmen)
|
100
|
+
- [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS)
|
101
|
+
|
102
|
+
### 0.22.0 (October 01, 2021)
|
103
|
+
|
104
|
+
Fixes and Functionality:
|
105
|
+
- Caseless header comparing in HTTP adapter ([#2880](https://github.com/axios/axios/pull/2880))
|
106
|
+
- Avoid package.json import fixing issues and warnings related to this ([#4041](https://github.com/axios/axios/pull/4041)), ([#4065](https://github.com/axios/axios/pull/4065))
|
107
|
+
- Fixed cancelToken leakage and added AbortController support ([#3305](https://github.com/axios/axios/pull/3305))
|
108
|
+
- Updating CI to run on release branches
|
109
|
+
- Bump follow redirects version
|
110
|
+
- Fixed default transitional config for custom Axios instance; ([#4052](https://github.com/axios/axios/pull/4052))
|
111
|
+
|
112
|
+
Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:
|
113
|
+
|
114
|
+
- [Jay](mailto:jasonsaayman@gmail.com)
|
115
|
+
- [Matt R. Wilson](https://github.com/mastermatt)
|
116
|
+
- [Xianming Zhong](https://github.com/chinesedfan)
|
117
|
+
- [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS)
|
118
|
+
|
3
119
|
### 0.21.4 (September 6, 2021)
|
4
120
|
|
5
121
|
Fixes and Functionality:
|
6
|
-
- Fixing JSON transform when data is stringified. Providing backward
|
122
|
+
- Fixing JSON transform when data is stringified. Providing backward compatability and complying to the JSON RFC standard ([#4020](https://github.com/axios/axios/pull/4020))
|
7
123
|
|
8
124
|
Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:
|
9
125
|
|
package/README.md
CHANGED
@@ -32,6 +32,7 @@ Promise based HTTP client for the browser and node.js
|
|
32
32
|
- [Custom instance defaults](#custom-instance-defaults)
|
33
33
|
- [Config order of precedence](#config-order-of-precedence)
|
34
34
|
- [Interceptors](#interceptors)
|
35
|
+
- [Multiple Interceptors](#multiple-interceptors)
|
35
36
|
- [Handling Errors](#handling-errors)
|
36
37
|
- [Cancellation](#cancellation)
|
37
38
|
- [Using application/x-www-form-urlencoded format](#using-applicationx-www-form-urlencoded-format)
|
@@ -452,11 +453,22 @@ These are the available config options for making requests. Only the `url` is re
|
|
452
453
|
cancelToken: new CancelToken(function (cancel) {
|
453
454
|
}),
|
454
455
|
|
456
|
+
// an alternative way to cancel Axios requests using AbortController
|
457
|
+
signal: new AbortController().signal,
|
458
|
+
|
455
459
|
// `decompress` indicates whether or not the response body should be decompressed
|
456
460
|
// automatically. If set to `true` will also remove the 'content-encoding' header
|
457
461
|
// from the responses objects of all decompressed responses
|
458
462
|
// - Node only (XHR cannot turn off decompression)
|
459
|
-
decompress: true
|
463
|
+
decompress: true // default
|
464
|
+
|
465
|
+
// `insecureHTTPParser` boolean.
|
466
|
+
// Indicates where to use an insecure HTTP parser that accepts invalid HTTP headers.
|
467
|
+
// This may allow interoperability with non-conformant HTTP implementations.
|
468
|
+
// Using the insecure parser should be avoided.
|
469
|
+
// see options https://nodejs.org/dist/latest-v12.x/docs/api/http.html#http_http_request_url_options_callback
|
470
|
+
// see also https://nodejs.org/en/blog/vulnerability/february-2020-security-releases/#strict-http-header-parsing-none
|
471
|
+
insecureHTTPParser: undefined // default
|
460
472
|
|
461
473
|
// transitional options for backward compatibility that may be removed in the newer versions
|
462
474
|
transitional: {
|
@@ -634,6 +646,21 @@ axios.interceptors.request.use(function (config) {
|
|
634
646
|
}, null, { runWhen: onGetCall });
|
635
647
|
```
|
636
648
|
|
649
|
+
### Multiple Interceptors
|
650
|
+
|
651
|
+
Given you add multiple response interceptors
|
652
|
+
and when the response was fulfilled
|
653
|
+
- then each interceptor is executed
|
654
|
+
- then they are executed in the order they were added
|
655
|
+
- then only the last interceptor's result is returned
|
656
|
+
- then every interceptor receives the result of it's predecessor
|
657
|
+
- and when the fulfillment-interceptor throws
|
658
|
+
- then the following fulfillment-interceptor is not called
|
659
|
+
- then the following rejection-interceptor is called
|
660
|
+
- once caught, another following fulfill-interceptor is called again (just like in a promise chain).
|
661
|
+
|
662
|
+
Read [the interceptor tests](./test/specs/interceptors.spec.js) for seeing all this in code.
|
663
|
+
|
637
664
|
## Handling Errors
|
638
665
|
|
639
666
|
```js
|
@@ -726,7 +753,20 @@ axios.get('/user/12345', {
|
|
726
753
|
cancel();
|
727
754
|
```
|
728
755
|
|
729
|
-
|
756
|
+
Axios supports AbortController to abort requests in [`fetch API`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API#aborting_a_fetch) way:
|
757
|
+
```js
|
758
|
+
const controller = new AbortController();
|
759
|
+
|
760
|
+
axios.get('/foo/bar', {
|
761
|
+
signal: controller.signal
|
762
|
+
}).then(function(response) {
|
763
|
+
//...
|
764
|
+
});
|
765
|
+
// cancel the request
|
766
|
+
controller.abort()
|
767
|
+
```
|
768
|
+
|
769
|
+
> Note: you can cancel several requests with the same cancel token/abort controller.
|
730
770
|
> 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.
|
731
771
|
|
732
772
|
## Using application/x-www-form-urlencoded format
|
@@ -861,7 +901,7 @@ You can use Gitpod an online IDE(which is free for Open Source) for contributing
|
|
861
901
|
|
862
902
|
## Credits
|
863
903
|
|
864
|
-
axios is heavily inspired by the [$http service](https://docs.angularjs.org/api/ng/service/$http) provided in [
|
904
|
+
axios is heavily inspired by the [$http service](https://docs.angularjs.org/api/ng/service/$http) provided in [AngularJS](https://angularjs.org/). Ultimately axios is an effort to provide a standalone `$http`-like service for use outside of AngularJS.
|
865
905
|
|
866
906
|
## License
|
867
907
|
|
package/UPGRADE_GUIDE.md
CHANGED