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/esm/axios.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Axios v1.
|
|
1
|
+
/*! Axios v1.11.0 Copyright (c) 2025 Matt Zabriskie and contributors */
|
|
2
2
|
function bind(fn, thisArg) {
|
|
3
3
|
return function wrap() {
|
|
4
4
|
return fn.apply(thisArg, arguments);
|
|
@@ -139,6 +139,27 @@ const isPlainObject = (val) => {
|
|
|
139
139
|
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
|
|
140
140
|
};
|
|
141
141
|
|
|
142
|
+
/**
|
|
143
|
+
* Determine if a value is an empty object (safely handles Buffers)
|
|
144
|
+
*
|
|
145
|
+
* @param {*} val The value to test
|
|
146
|
+
*
|
|
147
|
+
* @returns {boolean} True if value is an empty object, otherwise false
|
|
148
|
+
*/
|
|
149
|
+
const isEmptyObject = (val) => {
|
|
150
|
+
// Early return for non-objects or Buffers to prevent RangeError
|
|
151
|
+
if (!isObject(val) || isBuffer(val)) {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
try {
|
|
156
|
+
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
|
157
|
+
} catch (e) {
|
|
158
|
+
// Fallback for any other objects that might cause RangeError with Object.keys()
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
|
|
142
163
|
/**
|
|
143
164
|
* Determine if a value is a Date
|
|
144
165
|
*
|
|
@@ -261,6 +282,11 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
|
261
282
|
fn.call(null, obj[i], i, obj);
|
|
262
283
|
}
|
|
263
284
|
} else {
|
|
285
|
+
// Buffer check
|
|
286
|
+
if (isBuffer(obj)) {
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
|
|
264
290
|
// Iterate over object keys
|
|
265
291
|
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
266
292
|
const len = keys.length;
|
|
@@ -274,6 +300,10 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
|
274
300
|
}
|
|
275
301
|
|
|
276
302
|
function findKey(obj, key) {
|
|
303
|
+
if (isBuffer(obj)){
|
|
304
|
+
return null;
|
|
305
|
+
}
|
|
306
|
+
|
|
277
307
|
key = key.toLowerCase();
|
|
278
308
|
const keys = Object.keys(obj);
|
|
279
309
|
let i = keys.length;
|
|
@@ -627,6 +657,11 @@ const toJSONObject = (obj) => {
|
|
|
627
657
|
return;
|
|
628
658
|
}
|
|
629
659
|
|
|
660
|
+
//Buffer check
|
|
661
|
+
if (isBuffer(source)) {
|
|
662
|
+
return source;
|
|
663
|
+
}
|
|
664
|
+
|
|
630
665
|
if(!('toJSON' in source)) {
|
|
631
666
|
stack[i] = source;
|
|
632
667
|
const target = isArray(source) ? [] : {};
|
|
@@ -698,6 +733,7 @@ const utils$1 = {
|
|
|
698
733
|
isBoolean,
|
|
699
734
|
isObject,
|
|
700
735
|
isPlainObject,
|
|
736
|
+
isEmptyObject,
|
|
701
737
|
isReadableStream,
|
|
702
738
|
isRequest,
|
|
703
739
|
isResponse,
|
|
@@ -1329,7 +1365,7 @@ const platform = {
|
|
|
1329
1365
|
};
|
|
1330
1366
|
|
|
1331
1367
|
function toURLEncodedForm(data, options) {
|
|
1332
|
-
return toFormData$1(data, new platform.classes.URLSearchParams(),
|
|
1368
|
+
return toFormData$1(data, new platform.classes.URLSearchParams(), {
|
|
1333
1369
|
visitor: function(value, key, path, helpers) {
|
|
1334
1370
|
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
1335
1371
|
this.append(key, value.toString('base64'));
|
|
@@ -1337,8 +1373,9 @@ function toURLEncodedForm(data, options) {
|
|
|
1337
1373
|
}
|
|
1338
1374
|
|
|
1339
1375
|
return helpers.defaultVisitor.apply(this, arguments);
|
|
1340
|
-
}
|
|
1341
|
-
|
|
1376
|
+
},
|
|
1377
|
+
...options
|
|
1378
|
+
});
|
|
1342
1379
|
}
|
|
1343
1380
|
|
|
1344
1381
|
/**
|
|
@@ -2091,7 +2128,7 @@ function throttle(fn, freq) {
|
|
|
2091
2128
|
clearTimeout(timer);
|
|
2092
2129
|
timer = null;
|
|
2093
2130
|
}
|
|
2094
|
-
fn
|
|
2131
|
+
fn(...args);
|
|
2095
2132
|
};
|
|
2096
2133
|
|
|
2097
2134
|
const throttled = (...args) => {
|
|
@@ -2347,7 +2384,7 @@ function mergeConfig$1(config1, config2) {
|
|
|
2347
2384
|
headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
|
|
2348
2385
|
};
|
|
2349
2386
|
|
|
2350
|
-
utils$1.forEach(Object.keys(
|
|
2387
|
+
utils$1.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
|
|
2351
2388
|
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
2352
2389
|
const configValue = merge(config1[prop], config2[prop], prop);
|
|
2353
2390
|
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
@@ -3088,7 +3125,7 @@ function dispatchRequest(config) {
|
|
|
3088
3125
|
});
|
|
3089
3126
|
}
|
|
3090
3127
|
|
|
3091
|
-
const VERSION$1 = "1.
|
|
3128
|
+
const VERSION$1 = "1.11.0";
|
|
3092
3129
|
|
|
3093
3130
|
const validators$1 = {};
|
|
3094
3131
|
|
|
@@ -3327,8 +3364,8 @@ class Axios$1 {
|
|
|
3327
3364
|
|
|
3328
3365
|
if (!synchronousRequestInterceptors) {
|
|
3329
3366
|
const chain = [dispatchRequest.bind(this), undefined];
|
|
3330
|
-
chain.unshift
|
|
3331
|
-
chain.push
|
|
3367
|
+
chain.unshift(...requestInterceptorChain);
|
|
3368
|
+
chain.push(...responseInterceptorChain);
|
|
3332
3369
|
len = chain.length;
|
|
3333
3370
|
|
|
3334
3371
|
promise = Promise.resolve(config);
|