axios 1.13.1 → 1.13.3
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 +85 -0
- package/MIGRATION_GUIDE.md +876 -2
- package/README.md +136 -81
- package/dist/axios.js +253 -150
- 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 +152 -168
- package/dist/browser/axios.cjs.map +1 -1
- package/dist/esm/axios.js +152 -168
- 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 +210 -218
- package/dist/node/axios.cjs.map +1 -1
- package/index.d.cts +21 -3
- package/index.d.ts +27 -7
- package/lib/adapters/README.md +1 -1
- package/lib/adapters/http.js +35 -28
- package/lib/adapters/xhr.js +2 -2
- package/lib/cancel/CanceledError.js +15 -18
- package/lib/core/Axios.js +8 -3
- package/lib/core/AxiosError.js +65 -102
- package/lib/core/InterceptorManager.js +2 -1
- package/lib/core/mergeConfig.js +2 -3
- package/lib/core/transformData.js +1 -1
- package/lib/env/data.js +1 -1
- package/lib/helpers/buildURL.js +7 -10
- package/lib/helpers/composeSignals.js +1 -1
- package/lib/helpers/cookies.js +1 -1
- package/lib/helpers/isAxiosError.js +1 -1
- package/lib/helpers/parseHeaders.js +1 -1
- package/lib/helpers/spread.js +1 -1
- package/lib/utils.js +24 -7
- package/package.json +26 -2
package/lib/helpers/spread.js
CHANGED
package/lib/utils.js
CHANGED
|
@@ -252,10 +252,11 @@ const trim = (str) => str.trim ?
|
|
|
252
252
|
* If 'obj' is an Object callback will be called passing
|
|
253
253
|
* the value, key, and complete object for each property.
|
|
254
254
|
*
|
|
255
|
-
* @param {Object|Array} obj The object to iterate
|
|
255
|
+
* @param {Object|Array<unknown>} obj The object to iterate
|
|
256
256
|
* @param {Function} fn The callback to invoke for each item
|
|
257
257
|
*
|
|
258
|
-
* @param {
|
|
258
|
+
* @param {Object} [options]
|
|
259
|
+
* @param {Boolean} [options.allOwnKeys = false]
|
|
259
260
|
* @returns {any}
|
|
260
261
|
*/
|
|
261
262
|
function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
@@ -332,7 +333,7 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
|
|
|
332
333
|
* Example:
|
|
333
334
|
*
|
|
334
335
|
* ```js
|
|
335
|
-
*
|
|
336
|
+
* const result = merge({foo: 123}, {foo: 456});
|
|
336
337
|
* console.log(result.foo); // outputs 456
|
|
337
338
|
* ```
|
|
338
339
|
*
|
|
@@ -369,15 +370,26 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
369
370
|
* @param {Object} b The object to copy properties from
|
|
370
371
|
* @param {Object} thisArg The object to bind function to
|
|
371
372
|
*
|
|
372
|
-
* @param {
|
|
373
|
+
* @param {Object} [options]
|
|
374
|
+
* @param {Boolean} [options.allOwnKeys]
|
|
373
375
|
* @returns {Object} The resulting value of object a
|
|
374
376
|
*/
|
|
375
377
|
const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
|
|
376
378
|
forEach(b, (val, key) => {
|
|
377
379
|
if (thisArg && isFunction(val)) {
|
|
378
|
-
a
|
|
380
|
+
Object.defineProperty(a, key, {
|
|
381
|
+
value: bind(val, thisArg),
|
|
382
|
+
writable: true,
|
|
383
|
+
enumerable: true,
|
|
384
|
+
configurable: true
|
|
385
|
+
});
|
|
379
386
|
} else {
|
|
380
|
-
a
|
|
387
|
+
Object.defineProperty(a, key, {
|
|
388
|
+
value: val,
|
|
389
|
+
writable: true,
|
|
390
|
+
enumerable: true,
|
|
391
|
+
configurable: true
|
|
392
|
+
});
|
|
381
393
|
}
|
|
382
394
|
}, {allOwnKeys});
|
|
383
395
|
return a;
|
|
@@ -408,7 +420,12 @@ const stripBOM = (content) => {
|
|
|
408
420
|
*/
|
|
409
421
|
const inherits = (constructor, superConstructor, props, descriptors) => {
|
|
410
422
|
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
|
411
|
-
constructor.prototype
|
|
423
|
+
Object.defineProperty(constructor.prototype, 'constructor', {
|
|
424
|
+
value: constructor,
|
|
425
|
+
writable: true,
|
|
426
|
+
enumerable: false,
|
|
427
|
+
configurable: true
|
|
428
|
+
});
|
|
412
429
|
Object.defineProperty(constructor, 'super', {
|
|
413
430
|
value: superConstructor.prototype
|
|
414
431
|
});
|
package/package.json
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "axios",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.3",
|
|
4
4
|
"description": "Promise based HTTP client for the browser and node.js",
|
|
5
|
-
"main": "
|
|
5
|
+
"main": "./dist/node/axios.cjs",
|
|
6
|
+
"module": "./index.js",
|
|
6
7
|
"exports": {
|
|
7
8
|
".": {
|
|
8
9
|
"types": {
|
|
9
10
|
"require": "./index.d.cts",
|
|
10
11
|
"default": "./index.d.ts"
|
|
11
12
|
},
|
|
13
|
+
"bun": {
|
|
14
|
+
"require": "./dist/node/axios.cjs",
|
|
15
|
+
"default": "./index.js"
|
|
16
|
+
},
|
|
12
17
|
"react-native": {
|
|
13
18
|
"require": "./dist/browser/axios.cjs",
|
|
14
19
|
"default": "./dist/esm/axios.js"
|
|
@@ -42,6 +47,7 @@
|
|
|
42
47
|
"scripts": {
|
|
43
48
|
"test": "npm run test:node && npm run test:browser && npm run test:package",
|
|
44
49
|
"test:node": "npm run test:mocha",
|
|
50
|
+
"test:node:coverage": "c8 npm run test:mocha",
|
|
45
51
|
"test:browser": "npm run test:karma",
|
|
46
52
|
"test:package": "npm run test:eslint && npm run test:dtslint && npm run test:exports",
|
|
47
53
|
"test:eslint": "node bin/ssl_hotfix.js eslint lib/**/*.js",
|
|
@@ -108,6 +114,7 @@
|
|
|
108
114
|
"abortcontroller-polyfill": "^1.7.5",
|
|
109
115
|
"auto-changelog": "^2.4.0",
|
|
110
116
|
"body-parser": "^1.20.2",
|
|
117
|
+
"c8": "^10.1.3",
|
|
111
118
|
"chalk": "^5.3.0",
|
|
112
119
|
"coveralls": "^3.1.1",
|
|
113
120
|
"cross-env": "^7.0.3",
|
|
@@ -235,5 +242,22 @@
|
|
|
235
242
|
"extends": [
|
|
236
243
|
"@commitlint/config-conventional"
|
|
237
244
|
]
|
|
245
|
+
},
|
|
246
|
+
"c8": {
|
|
247
|
+
"all": true,
|
|
248
|
+
"include": [
|
|
249
|
+
"lib/**/*.js",
|
|
250
|
+
"lib/**/*.ts"
|
|
251
|
+
],
|
|
252
|
+
"exclude": [
|
|
253
|
+
"test",
|
|
254
|
+
"sandbox"
|
|
255
|
+
],
|
|
256
|
+
"reporter": [
|
|
257
|
+
"text",
|
|
258
|
+
"lcov",
|
|
259
|
+
"html"
|
|
260
|
+
],
|
|
261
|
+
"report-dir": "./coverage"
|
|
238
262
|
}
|
|
239
263
|
}
|