axios 1.10.0 → 1.11.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 +17 -0
- package/README.md +1 -4
- package/dist/axios.js +39 -5
- 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 +46 -9
- package/dist/browser/axios.cjs.map +1 -1
- package/dist/esm/axios.js +46 -9
- 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 +46 -9
- package/dist/node/axios.cjs.map +1 -1
- package/index.d.cts +13 -2
- package/lib/core/Axios.js +2 -2
- package/lib/core/mergeConfig.js +1 -1
- package/lib/env/data.js +1 -1
- package/lib/helpers/throttle.js +1 -1
- package/lib/helpers/toURLEncodedForm.js +4 -3
- package/lib/utils.js +36 -0
- package/package.json +5 -5
package/dist/browser/axios.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Axios v1.
|
|
1
|
+
/*! Axios v1.11.0 Copyright (c) 2025 Matt Zabriskie and contributors */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
function bind(fn, thisArg) {
|
|
@@ -141,6 +141,27 @@ const isPlainObject = (val) => {
|
|
|
141
141
|
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
|
|
142
142
|
};
|
|
143
143
|
|
|
144
|
+
/**
|
|
145
|
+
* Determine if a value is an empty object (safely handles Buffers)
|
|
146
|
+
*
|
|
147
|
+
* @param {*} val The value to test
|
|
148
|
+
*
|
|
149
|
+
* @returns {boolean} True if value is an empty object, otherwise false
|
|
150
|
+
*/
|
|
151
|
+
const isEmptyObject = (val) => {
|
|
152
|
+
// Early return for non-objects or Buffers to prevent RangeError
|
|
153
|
+
if (!isObject(val) || isBuffer(val)) {
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
try {
|
|
158
|
+
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
|
159
|
+
} catch (e) {
|
|
160
|
+
// Fallback for any other objects that might cause RangeError with Object.keys()
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
|
|
144
165
|
/**
|
|
145
166
|
* Determine if a value is a Date
|
|
146
167
|
*
|
|
@@ -263,6 +284,11 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
|
263
284
|
fn.call(null, obj[i], i, obj);
|
|
264
285
|
}
|
|
265
286
|
} else {
|
|
287
|
+
// Buffer check
|
|
288
|
+
if (isBuffer(obj)) {
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
|
|
266
292
|
// Iterate over object keys
|
|
267
293
|
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
268
294
|
const len = keys.length;
|
|
@@ -276,6 +302,10 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
|
276
302
|
}
|
|
277
303
|
|
|
278
304
|
function findKey(obj, key) {
|
|
305
|
+
if (isBuffer(obj)){
|
|
306
|
+
return null;
|
|
307
|
+
}
|
|
308
|
+
|
|
279
309
|
key = key.toLowerCase();
|
|
280
310
|
const keys = Object.keys(obj);
|
|
281
311
|
let i = keys.length;
|
|
@@ -629,6 +659,11 @@ const toJSONObject = (obj) => {
|
|
|
629
659
|
return;
|
|
630
660
|
}
|
|
631
661
|
|
|
662
|
+
//Buffer check
|
|
663
|
+
if (isBuffer(source)) {
|
|
664
|
+
return source;
|
|
665
|
+
}
|
|
666
|
+
|
|
632
667
|
if(!('toJSON' in source)) {
|
|
633
668
|
stack[i] = source;
|
|
634
669
|
const target = isArray(source) ? [] : {};
|
|
@@ -700,6 +735,7 @@ var utils$1 = {
|
|
|
700
735
|
isBoolean,
|
|
701
736
|
isObject,
|
|
702
737
|
isPlainObject,
|
|
738
|
+
isEmptyObject,
|
|
703
739
|
isReadableStream,
|
|
704
740
|
isRequest,
|
|
705
741
|
isResponse,
|
|
@@ -1331,7 +1367,7 @@ var platform = {
|
|
|
1331
1367
|
};
|
|
1332
1368
|
|
|
1333
1369
|
function toURLEncodedForm(data, options) {
|
|
1334
|
-
return toFormData(data, new platform.classes.URLSearchParams(),
|
|
1370
|
+
return toFormData(data, new platform.classes.URLSearchParams(), {
|
|
1335
1371
|
visitor: function(value, key, path, helpers) {
|
|
1336
1372
|
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
1337
1373
|
this.append(key, value.toString('base64'));
|
|
@@ -1339,8 +1375,9 @@ function toURLEncodedForm(data, options) {
|
|
|
1339
1375
|
}
|
|
1340
1376
|
|
|
1341
1377
|
return helpers.defaultVisitor.apply(this, arguments);
|
|
1342
|
-
}
|
|
1343
|
-
|
|
1378
|
+
},
|
|
1379
|
+
...options
|
|
1380
|
+
});
|
|
1344
1381
|
}
|
|
1345
1382
|
|
|
1346
1383
|
/**
|
|
@@ -2093,7 +2130,7 @@ function throttle(fn, freq) {
|
|
|
2093
2130
|
clearTimeout(timer);
|
|
2094
2131
|
timer = null;
|
|
2095
2132
|
}
|
|
2096
|
-
fn
|
|
2133
|
+
fn(...args);
|
|
2097
2134
|
};
|
|
2098
2135
|
|
|
2099
2136
|
const throttled = (...args) => {
|
|
@@ -2349,7 +2386,7 @@ function mergeConfig(config1, config2) {
|
|
|
2349
2386
|
headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
|
|
2350
2387
|
};
|
|
2351
2388
|
|
|
2352
|
-
utils$1.forEach(Object.keys(
|
|
2389
|
+
utils$1.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
|
|
2353
2390
|
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
2354
2391
|
const configValue = merge(config1[prop], config2[prop], prop);
|
|
2355
2392
|
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
@@ -3090,7 +3127,7 @@ function dispatchRequest(config) {
|
|
|
3090
3127
|
});
|
|
3091
3128
|
}
|
|
3092
3129
|
|
|
3093
|
-
const VERSION = "1.
|
|
3130
|
+
const VERSION = "1.11.0";
|
|
3094
3131
|
|
|
3095
3132
|
const validators$1 = {};
|
|
3096
3133
|
|
|
@@ -3329,8 +3366,8 @@ class Axios {
|
|
|
3329
3366
|
|
|
3330
3367
|
if (!synchronousRequestInterceptors) {
|
|
3331
3368
|
const chain = [dispatchRequest.bind(this), undefined];
|
|
3332
|
-
chain.unshift
|
|
3333
|
-
chain.push
|
|
3369
|
+
chain.unshift(...requestInterceptorChain);
|
|
3370
|
+
chain.push(...responseInterceptorChain);
|
|
3334
3371
|
len = chain.length;
|
|
3335
3372
|
|
|
3336
3373
|
promise = Promise.resolve(config);
|