axios 0.22.0 → 0.26.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 +109 -0
- package/README.md +18 -1
- package/UPGRADE_GUIDE.md +6 -0
- package/dist/axios.js +16 -14
- package/dist/axios.map +1 -1
- package/dist/axios.min.js +1 -1
- package/dist/axios.min.map +1 -1
- package/index.d.ts +83 -37
- package/lib/adapters/http.js +49 -8
- package/lib/adapters/xhr.js +1 -1
- package/lib/core/Axios.js +5 -5
- package/lib/env/data.js +1 -1
- package/lib/helpers/isAbsoluteURL.js +1 -1
- package/lib/helpers/isAxiosError.js +3 -1
- package/lib/helpers/toFormData.js +55 -0
- package/lib/utils.js +4 -4
- package/package.json +4 -4
- package/tsconfig.json +14 -0
- package/tslint.json +6 -0
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,114 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
### 0.26.0 (February 13, 2022)
|
4
|
+
|
5
|
+
Fixes and Functionality:
|
6
|
+
- Fixed The timeoutErrorMessage property in config not work with Node.js ([#3581](https://github.com/axios/axios/pull/3581))
|
7
|
+
- Added errors to be displayed when the query parsing process itself fails ([#3961](https://github.com/axios/axios/pull/3961))
|
8
|
+
- Fix/remove url required ([#4426](https://github.com/axios/axios/pull/4426))
|
9
|
+
- Update follow-redirects dependency due to Vurnerbility ([#4462](https://github.com/axios/axios/pull/4462))
|
10
|
+
- Bump karma from 6.3.11 to 6.3.14 ([#4461](https://github.com/axios/axios/pull/4461))
|
11
|
+
- Bump follow-redirects from 1.14.7 to 1.14.8 ([#4473](https://github.com/axios/axios/pull/4473))
|
12
|
+
|
13
|
+
### 0.25.0 (January 18, 2022)
|
14
|
+
|
15
|
+
Breaking changes:
|
16
|
+
- Fixing maxBodyLength enforcement ([#3786](https://github.com/axios/axios/pull/3786))
|
17
|
+
- Don't rely on strict mode behaviour for arguments ([#3470](https://github.com/axios/axios/pull/3470))
|
18
|
+
- Adding error handling when missing url ([#3791](https://github.com/axios/axios/pull/3791))
|
19
|
+
- Update isAbsoluteURL.js removing escaping of non-special characters ([#3809](https://github.com/axios/axios/pull/3809))
|
20
|
+
- Use native Array.isArray() in utils.js ([#3836](https://github.com/axios/axios/pull/3836))
|
21
|
+
- Adding error handling inside stream end callback ([#3967](https://github.com/axios/axios/pull/3967))
|
22
|
+
|
23
|
+
Fixes and Functionality:
|
24
|
+
- Added aborted even handler ([#3916](https://github.com/axios/axios/pull/3916))
|
25
|
+
- Header types expanded allowing `boolean` and `number` types ([#4144](https://github.com/axios/axios/pull/4144))
|
26
|
+
- Fix cancel signature allowing cancel message to be `undefined` ([#3153](https://github.com/axios/axios/pull/3153))
|
27
|
+
- Updated type checks to be formulated better ([#3342](https://github.com/axios/axios/pull/3342))
|
28
|
+
- Avoid unnecessary buffer allocations ([#3321](https://github.com/axios/axios/pull/3321))
|
29
|
+
- Adding a socket handler to keep TCP connection live when processing long living requests ([#3422](https://github.com/axios/axios/pull/3422))
|
30
|
+
- Added toFormData helper function ([#3757](https://github.com/axios/axios/pull/3757))
|
31
|
+
- Adding responseEncoding prop type in AxiosRequestConfig ([#3918](https://github.com/axios/axios/pull/3918))
|
32
|
+
|
33
|
+
Internal and Tests:
|
34
|
+
- Adding axios-test-instance to ecosystem ([#3786](https://github.com/axios/axios/pull/3786))
|
35
|
+
- Optimize the logic of isAxiosError ([#3546](https://github.com/axios/axios/pull/3546))
|
36
|
+
- Add tests and documentation to display how multiple inceptors work ([#3564](https://github.com/axios/axios/pull/3564))
|
37
|
+
- Updating follow-redirects to version 1.14.7 ([#4379](https://github.com/axios/axios/pull/4379))
|
38
|
+
|
39
|
+
|
40
|
+
Documentation:
|
41
|
+
- Fixing changelog to show corrext pull request ([#4219](https://github.com/axios/axios/pull/4219))
|
42
|
+
- Update upgrade guide for https proxy setting ([#3604](https://github.com/axios/axios/pull/3604))
|
43
|
+
|
44
|
+
Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:
|
45
|
+
|
46
|
+
- [Jay](mailto:jasonsaayman@gmail.com)
|
47
|
+
- [Rijk van Zanten](https://github.com/rijkvanzanten)
|
48
|
+
- [Kohta Ito](https://github.com/koh110)
|
49
|
+
- [Brandon Faulkner](https://github.com/bfaulk96)
|
50
|
+
- [Stefano Magni](https://github.com/NoriSte)
|
51
|
+
- [enofan](https://github.com/fanguangyi)
|
52
|
+
- [Andrey Pechkurov](https://github.com/puzpuzpuz)
|
53
|
+
- [Doowonee](https://github.com/doowonee)
|
54
|
+
- [Emil Broman](https://github.com/emilbroman-eqt)
|
55
|
+
- [Remco Haszing](https://github.com/remcohaszing)
|
56
|
+
- [Black-Hole](https://github.com/BlackHole1)
|
57
|
+
- [Wolfram Kriesing](https://github.com/wolframkriesing)
|
58
|
+
- [Andrew Ovens](https://github.com/repl-andrew-ovens)
|
59
|
+
- [Paulo Renato](https://github.com/PauloRSF)
|
60
|
+
- [Ben Carp](https://github.com/carpben)
|
61
|
+
- [Hirotaka Tagawa](https://github.com/wafuwafu13)
|
62
|
+
- [狼族小狈](https://github.com/lzxb)
|
63
|
+
- [C. Lewis](https://github.com/ctjlewis)
|
64
|
+
- [Felipe Carvalho](https://github.com/FCarvalhoVII)
|
65
|
+
- [Daniel](https://github.com/djs113)
|
66
|
+
- [Gustavo Sales](https://github.com/gussalesdev)
|
67
|
+
|
68
|
+
### 0.24.0 (October 25, 2021)
|
69
|
+
|
70
|
+
Breaking changes:
|
71
|
+
- 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))
|
72
|
+
|
73
|
+
Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:
|
74
|
+
|
75
|
+
- [Jay](mailto:jasonsaayman@gmail.com)
|
76
|
+
- [Rodry](https://github.com/ImRodry)
|
77
|
+
- [Remco Haszing](https://github.com/remcohaszing)
|
78
|
+
- [Isaiah Thomason](https://github.com/ITenthusiasm)
|
79
|
+
|
80
|
+
### 0.23.0 (October 12, 2021)
|
81
|
+
|
82
|
+
Breaking changes:
|
83
|
+
- Distinguish request and response data types ([#4116](https://github.com/axios/axios/pull/4116))
|
84
|
+
- Change never type to unknown ([#4142](https://github.com/axios/axios/pull/4142))
|
85
|
+
- Fixed TransitionalOptions typings ([#4147](https://github.com/axios/axios/pull/4147))
|
86
|
+
|
87
|
+
Fixes and Functionality:
|
88
|
+
- Adding globalObject: 'this' to webpack config ([#3176](https://github.com/axios/axios/pull/3176))
|
89
|
+
- Adding insecureHTTPParser type to AxiosRequestConfig ([#4066](https://github.com/axios/axios/pull/4066))
|
90
|
+
- Fix missing semicolon in typings ([#4115](https://github.com/axios/axios/pull/4115))
|
91
|
+
- Fix response headers types ([#4136](https://github.com/axios/axios/pull/4136))
|
92
|
+
|
93
|
+
Internal and Tests:
|
94
|
+
- Improve timeout error when timeout is browser default ([#3209](https://github.com/axios/axios/pull/3209))
|
95
|
+
- Fix node version on CI ([#4069](https://github.com/axios/axios/pull/4069))
|
96
|
+
- Added testing to TypeScript portion of project ([#4140](https://github.com/axios/axios/pull/4140))
|
97
|
+
|
98
|
+
Documentation:
|
99
|
+
- Rename Angular to AngularJS ([#4114](https://github.com/axios/axios/pull/4114))
|
100
|
+
|
101
|
+
Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:
|
102
|
+
|
103
|
+
- [Jay](mailto:jasonsaayman@gmail.com)
|
104
|
+
- [Evan-Finkelstein](https://github.com/Evan-Finkelstein)
|
105
|
+
- [Paweł Szymański](https://github.com/Jezorko)
|
106
|
+
- [Dobes Vandermeer](https://github.com/dobesv)
|
107
|
+
- [Claas Augner](https://github.com/caugner)
|
108
|
+
- [Remco Haszing](https://github.com/remcohaszing)
|
109
|
+
- [Evgeniy](https://github.com/egmen)
|
110
|
+
- [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS)
|
111
|
+
|
3
112
|
### 0.22.0 (October 01, 2021)
|
4
113
|
|
5
114
|
Fixes and Functionality:
|
package/README.md
CHANGED
@@ -9,6 +9,7 @@
|
|
9
9
|
[](http://npm-stat.com/charts.html?package=axios)
|
10
10
|
[](https://gitter.im/mzabriskie/axios)
|
11
11
|
[](https://www.codetriage.com/axios/axios)
|
12
|
+
[](https://snyk.io/test/npm/axios)
|
12
13
|
|
13
14
|
Promise based HTTP client for the browser and node.js
|
14
15
|
|
@@ -32,6 +33,7 @@ Promise based HTTP client for the browser and node.js
|
|
32
33
|
- [Custom instance defaults](#custom-instance-defaults)
|
33
34
|
- [Config order of precedence](#config-order-of-precedence)
|
34
35
|
- [Interceptors](#interceptors)
|
36
|
+
- [Multiple Interceptors](#multiple-interceptors)
|
35
37
|
- [Handling Errors](#handling-errors)
|
36
38
|
- [Cancellation](#cancellation)
|
37
39
|
- [Using application/x-www-form-urlencoded format](#using-applicationx-www-form-urlencoded-format)
|
@@ -645,6 +647,21 @@ axios.interceptors.request.use(function (config) {
|
|
645
647
|
}, null, { runWhen: onGetCall });
|
646
648
|
```
|
647
649
|
|
650
|
+
### Multiple Interceptors
|
651
|
+
|
652
|
+
Given you add multiple response interceptors
|
653
|
+
and when the response was fulfilled
|
654
|
+
- then each interceptor is executed
|
655
|
+
- then they are executed in the order they were added
|
656
|
+
- then only the last interceptor's result is returned
|
657
|
+
- then every interceptor receives the result of it's predecessor
|
658
|
+
- and when the fulfillment-interceptor throws
|
659
|
+
- then the following fulfillment-interceptor is not called
|
660
|
+
- then the following rejection-interceptor is called
|
661
|
+
- once caught, another following fulfill-interceptor is called again (just like in a promise chain).
|
662
|
+
|
663
|
+
Read [the interceptor tests](./test/specs/interceptors.spec.js) for seeing all this in code.
|
664
|
+
|
648
665
|
## Handling Errors
|
649
666
|
|
650
667
|
```js
|
@@ -885,7 +902,7 @@ You can use Gitpod an online IDE(which is free for Open Source) for contributing
|
|
885
902
|
|
886
903
|
## Credits
|
887
904
|
|
888
|
-
axios is heavily inspired by the [$http service](https://docs.angularjs.org/api/ng/service/$http) provided in [
|
905
|
+
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.
|
889
906
|
|
890
907
|
## License
|
891
908
|
|
package/UPGRADE_GUIDE.md
CHANGED
package/dist/axios.js
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
exports["axios"] = factory();
|
8
8
|
else
|
9
9
|
root["axios"] = factory();
|
10
|
-
})(
|
10
|
+
})(this, function() {
|
11
11
|
return /******/ (function(modules) { // webpackBootstrap
|
12
12
|
/******/ // The module cache
|
13
13
|
/******/ var installedModules = {};
|
@@ -239,7 +239,7 @@ module.exports = function xhrAdapter(config) {
|
|
239
239
|
|
240
240
|
// Handle timeout
|
241
241
|
request.ontimeout = function handleTimeout() {
|
242
|
-
var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
|
242
|
+
var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
|
243
243
|
var transitional = config.transitional || defaults.transitional;
|
244
244
|
if (config.timeoutErrorMessage) {
|
245
245
|
timeoutErrorMessage = config.timeoutErrorMessage;
|
@@ -615,14 +615,14 @@ function Axios(instanceConfig) {
|
|
615
615
|
*
|
616
616
|
* @param {Object} config The config specific for this request (merged with this.defaults)
|
617
617
|
*/
|
618
|
-
Axios.prototype.request = function request(config) {
|
618
|
+
Axios.prototype.request = function request(configOrUrl, config) {
|
619
619
|
/*eslint no-param-reassign:0*/
|
620
620
|
// Allow for axios('example/url'[, config]) a la fetch API
|
621
|
-
if (typeof
|
622
|
-
config = arguments[1] || {};
|
623
|
-
config.url = arguments[0];
|
624
|
-
} else {
|
621
|
+
if (typeof configOrUrl === 'string') {
|
625
622
|
config = config || {};
|
623
|
+
config.url = configOrUrl;
|
624
|
+
} else {
|
625
|
+
config = configOrUrl || {};
|
626
626
|
}
|
627
627
|
|
628
628
|
config = mergeConfig(this.defaults, config);
|
@@ -1357,7 +1357,7 @@ module.exports = defaults;
|
|
1357
1357
|
/***/ (function(module, exports) {
|
1358
1358
|
|
1359
1359
|
module.exports = {
|
1360
|
-
"version": "0.
|
1360
|
+
"version": "0.26.0"
|
1361
1361
|
};
|
1362
1362
|
|
1363
1363
|
/***/ }),
|
@@ -1578,7 +1578,7 @@ module.exports = function isAbsoluteURL(url) {
|
|
1578
1578
|
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
1579
1579
|
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
1580
1580
|
// by any combination of letters, digits, plus, period, or hyphen.
|
1581
|
-
return /^([a-z][a-z\d
|
1581
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
1582
1582
|
};
|
1583
1583
|
|
1584
1584
|
|
@@ -1594,6 +1594,8 @@ module.exports = function isAbsoluteURL(url) {
|
|
1594
1594
|
"use strict";
|
1595
1595
|
|
1596
1596
|
|
1597
|
+
var utils = __webpack_require__(/*! ./../utils */ "./lib/utils.js");
|
1598
|
+
|
1597
1599
|
/**
|
1598
1600
|
* Determines whether the payload is an error thrown by Axios
|
1599
1601
|
*
|
@@ -1601,7 +1603,7 @@ module.exports = function isAbsoluteURL(url) {
|
|
1601
1603
|
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
1602
1604
|
*/
|
1603
1605
|
module.exports = function isAxiosError(payload) {
|
1604
|
-
return (
|
1606
|
+
return utils.isObject(payload) && (payload.isAxiosError === true);
|
1605
1607
|
};
|
1606
1608
|
|
1607
1609
|
|
@@ -1932,7 +1934,7 @@ var toString = Object.prototype.toString;
|
|
1932
1934
|
* @returns {boolean} True if value is an Array, otherwise false
|
1933
1935
|
*/
|
1934
1936
|
function isArray(val) {
|
1935
|
-
return
|
1937
|
+
return Array.isArray(val);
|
1936
1938
|
}
|
1937
1939
|
|
1938
1940
|
/**
|
@@ -1973,7 +1975,7 @@ function isArrayBuffer(val) {
|
|
1973
1975
|
* @returns {boolean} True if value is an FormData, otherwise false
|
1974
1976
|
*/
|
1975
1977
|
function isFormData(val) {
|
1976
|
-
return (
|
1978
|
+
return toString.call(val) === '[object FormData]';
|
1977
1979
|
}
|
1978
1980
|
|
1979
1981
|
/**
|
@@ -1987,7 +1989,7 @@ function isArrayBufferView(val) {
|
|
1987
1989
|
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
|
1988
1990
|
result = ArrayBuffer.isView(val);
|
1989
1991
|
} else {
|
1990
|
-
result = (val) && (val.buffer) && (val.buffer
|
1992
|
+
result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
|
1991
1993
|
}
|
1992
1994
|
return result;
|
1993
1995
|
}
|
@@ -2094,7 +2096,7 @@ function isStream(val) {
|
|
2094
2096
|
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
2095
2097
|
*/
|
2096
2098
|
function isURLSearchParams(val) {
|
2097
|
-
return
|
2099
|
+
return toString.call(val) === '[object URLSearchParams]';
|
2098
2100
|
}
|
2099
2101
|
|
2100
2102
|
/**
|