axios 1.12.1 → 1.13.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 +402 -356
- package/README.md +153 -48
- package/dist/axios.js +155 -83
- package/dist/axios.js.map +1 -1
- package/dist/axios.min.js +2 -2
- package/dist/axios.min.js.map +1 -1
- package/dist/browser/axios.cjs +140 -73
- package/dist/browser/axios.cjs.map +1 -1
- package/dist/esm/axios.js +140 -73
- package/dist/esm/axios.js.map +1 -1
- package/dist/esm/axios.min.js +2 -2
- package/dist/esm/axios.min.js.map +1 -1
- package/dist/node/axios.cjs +361 -114
- package/dist/node/axios.cjs.map +1 -1
- package/index.d.cts +4 -0
- package/index.d.ts +4 -0
- package/lib/adapters/adapters.js +85 -40
- package/lib/adapters/fetch.js +13 -11
- package/lib/adapters/http.js +221 -43
- package/lib/core/Axios.js +0 -2
- package/lib/core/InterceptorManager.js +1 -1
- package/lib/core/mergeConfig.js +4 -4
- package/lib/env/data.js +1 -1
- package/lib/helpers/HttpStatusCode.js +6 -0
- package/lib/helpers/bind.js +7 -0
- package/lib/helpers/cookies.js +24 -13
- package/lib/utils.js +2 -4
- package/package.json +15 -7
package/lib/env/data.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "1.
|
|
1
|
+
export const VERSION = "1.13.0";
|
|
@@ -62,6 +62,12 @@ const HttpStatusCode = {
|
|
|
62
62
|
LoopDetected: 508,
|
|
63
63
|
NotExtended: 510,
|
|
64
64
|
NetworkAuthenticationRequired: 511,
|
|
65
|
+
WebServerIsDown: 521,
|
|
66
|
+
ConnectionTimedOut: 522,
|
|
67
|
+
OriginIsUnreachable: 523,
|
|
68
|
+
TimeoutOccurred: 524,
|
|
69
|
+
SslHandshakeFailed: 525,
|
|
70
|
+
InvalidSslCertificate: 526,
|
|
65
71
|
};
|
|
66
72
|
|
|
67
73
|
Object.entries(HttpStatusCode).forEach(([key, value]) => {
|
package/lib/helpers/bind.js
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Create a bound version of a function with a specified `this` context
|
|
5
|
+
*
|
|
6
|
+
* @param {Function} fn - The function to bind
|
|
7
|
+
* @param {*} thisArg - The value to be passed as the `this` parameter
|
|
8
|
+
* @returns {Function} A new function that will call the original function with the specified `this` context
|
|
9
|
+
*/
|
|
3
10
|
export default function bind(fn, thisArg) {
|
|
4
11
|
return function wrap() {
|
|
5
12
|
return fn.apply(thisArg, arguments);
|
package/lib/helpers/cookies.js
CHANGED
|
@@ -5,27 +5,38 @@ export default platform.hasStandardBrowserEnv ?
|
|
|
5
5
|
|
|
6
6
|
// Standard browser envs support document.cookie
|
|
7
7
|
{
|
|
8
|
-
write(name, value, expires, path, domain, secure) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
utils.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
write(name, value, expires, path, domain, secure, sameSite) {
|
|
9
|
+
if (typeof document === 'undefined') return;
|
|
10
|
+
|
|
11
|
+
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
12
|
+
|
|
13
|
+
if (utils.isNumber(expires)) {
|
|
14
|
+
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
15
|
+
}
|
|
16
|
+
if (utils.isString(path)) {
|
|
17
|
+
cookie.push(`path=${path}`);
|
|
18
|
+
}
|
|
19
|
+
if (utils.isString(domain)) {
|
|
20
|
+
cookie.push(`domain=${domain}`);
|
|
21
|
+
}
|
|
22
|
+
if (secure === true) {
|
|
23
|
+
cookie.push('secure');
|
|
24
|
+
}
|
|
25
|
+
if (utils.isString(sameSite)) {
|
|
26
|
+
cookie.push(`SameSite=${sameSite}`);
|
|
27
|
+
}
|
|
18
28
|
|
|
19
29
|
document.cookie = cookie.join('; ');
|
|
20
30
|
},
|
|
21
31
|
|
|
22
32
|
read(name) {
|
|
23
|
-
|
|
24
|
-
|
|
33
|
+
if (typeof document === 'undefined') return null;
|
|
34
|
+
const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
|
|
35
|
+
return match ? decodeURIComponent(match[1]) : null;
|
|
25
36
|
},
|
|
26
37
|
|
|
27
38
|
remove(name) {
|
|
28
|
-
this.write(name, '', Date.now() - 86400000);
|
|
39
|
+
this.write(name, '', Date.now() - 86400000, '/');
|
|
29
40
|
}
|
|
30
41
|
}
|
|
31
42
|
|
package/lib/utils.js
CHANGED
|
@@ -351,10 +351,8 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
351
351
|
result[targetKey] = merge({}, val);
|
|
352
352
|
} else if (isArray(val)) {
|
|
353
353
|
result[targetKey] = val.slice();
|
|
354
|
-
} else {
|
|
355
|
-
|
|
356
|
-
result[targetKey] = val;
|
|
357
|
-
}
|
|
354
|
+
} else if (!skipUndefined || !isUndefined(val)) {
|
|
355
|
+
result[targetKey] = val;
|
|
358
356
|
}
|
|
359
357
|
}
|
|
360
358
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "axios",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.0",
|
|
4
4
|
"description": "Promise based HTTP client for the browser and node.js",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"exports": {
|
|
@@ -40,12 +40,15 @@
|
|
|
40
40
|
"type": "module",
|
|
41
41
|
"types": "index.d.ts",
|
|
42
42
|
"scripts": {
|
|
43
|
-
"test": "npm run test:
|
|
43
|
+
"test": "npm run test:node && npm run test:browser && npm run test:package",
|
|
44
|
+
"test:node": "npm run test:mocha",
|
|
45
|
+
"test:browser": "npm run test:karma",
|
|
46
|
+
"test:package": "npm run test:eslint && npm run test:dtslint && npm run test:exports",
|
|
44
47
|
"test:eslint": "node bin/ssl_hotfix.js eslint lib/**/*.js",
|
|
45
48
|
"test:dtslint": "dtslint --localTs node_modules/typescript/lib",
|
|
46
49
|
"test:mocha": "node bin/ssl_hotfix.js mocha test/unit/**/*.js --timeout 30000 --exit",
|
|
47
50
|
"test:exports": "node bin/ssl_hotfix.js mocha test/module/test.js --timeout 30000 --exit",
|
|
48
|
-
"test:karma": "node bin/
|
|
51
|
+
"test:karma": "node ./bin/run-karma-tests.js",
|
|
49
52
|
"test:karma:firefox": "node bin/ssl_hotfix.js cross-env LISTEN_ADDR=:: Browsers=Firefox karma start karma.conf.cjs --single-run",
|
|
50
53
|
"test:karma:server": "node bin/ssl_hotfix.js cross-env karma start karma.conf.cjs",
|
|
51
54
|
"test:build:version": "node ./bin/check-build-version.js",
|
|
@@ -77,7 +80,12 @@
|
|
|
77
80
|
"http",
|
|
78
81
|
"ajax",
|
|
79
82
|
"promise",
|
|
80
|
-
"node"
|
|
83
|
+
"node",
|
|
84
|
+
"browser",
|
|
85
|
+
"fetch",
|
|
86
|
+
"rest",
|
|
87
|
+
"api",
|
|
88
|
+
"client"
|
|
81
89
|
],
|
|
82
90
|
"author": "Matt Zabriskie",
|
|
83
91
|
"license": "MIT",
|
|
@@ -138,11 +146,11 @@
|
|
|
138
146
|
"rollup-plugin-auto-external": "^2.0.0",
|
|
139
147
|
"rollup-plugin-bundle-size": "^1.0.3",
|
|
140
148
|
"rollup-plugin-terser": "^7.0.2",
|
|
149
|
+
"selfsigned": "^3.0.1",
|
|
141
150
|
"sinon": "^4.5.0",
|
|
142
151
|
"stream-throttle": "^0.1.3",
|
|
143
152
|
"string-replace-async": "^3.0.2",
|
|
144
153
|
"tar-stream": "^3.1.7",
|
|
145
|
-
"terser-webpack-plugin": "^4.2.3",
|
|
146
154
|
"typescript": "^4.9.5"
|
|
147
155
|
},
|
|
148
156
|
"browser": {
|
|
@@ -171,8 +179,8 @@
|
|
|
171
179
|
],
|
|
172
180
|
"contributors": [
|
|
173
181
|
"Matt Zabriskie (https://github.com/mzabriskie)",
|
|
174
|
-
"Nick Uraltsev (https://github.com/nickuraltsev)",
|
|
175
182
|
"Dmitriy Mozgovoy (https://github.com/DigitalBrainJS)",
|
|
183
|
+
"Nick Uraltsev (https://github.com/nickuraltsev)",
|
|
176
184
|
"Jay (https://github.com/jasonsaayman)",
|
|
177
185
|
"Emily Morehouse (https://github.com/emilyemorehouse)",
|
|
178
186
|
"Rubén Norte (https://github.com/rubennorte)",
|
|
@@ -182,7 +190,7 @@
|
|
|
182
190
|
"Remco Haszing (https://github.com/remcohaszing)",
|
|
183
191
|
"Rikki Gibson (https://github.com/RikkiGibson)",
|
|
184
192
|
"Willian Agostini (https://github.com/WillianAgostini)",
|
|
185
|
-
"
|
|
193
|
+
"Ben Carp (https://github.com/carpben)"
|
|
186
194
|
],
|
|
187
195
|
"sideEffects": false,
|
|
188
196
|
"release-it": {
|