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/node/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
|
const FormData$1 = require('form-data');
|
|
@@ -166,6 +166,27 @@ const isPlainObject = (val) => {
|
|
|
166
166
|
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
|
|
167
167
|
};
|
|
168
168
|
|
|
169
|
+
/**
|
|
170
|
+
* Determine if a value is an empty object (safely handles Buffers)
|
|
171
|
+
*
|
|
172
|
+
* @param {*} val The value to test
|
|
173
|
+
*
|
|
174
|
+
* @returns {boolean} True if value is an empty object, otherwise false
|
|
175
|
+
*/
|
|
176
|
+
const isEmptyObject = (val) => {
|
|
177
|
+
// Early return for non-objects or Buffers to prevent RangeError
|
|
178
|
+
if (!isObject(val) || isBuffer(val)) {
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
try {
|
|
183
|
+
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
|
184
|
+
} catch (e) {
|
|
185
|
+
// Fallback for any other objects that might cause RangeError with Object.keys()
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
|
|
169
190
|
/**
|
|
170
191
|
* Determine if a value is a Date
|
|
171
192
|
*
|
|
@@ -288,6 +309,11 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
|
288
309
|
fn.call(null, obj[i], i, obj);
|
|
289
310
|
}
|
|
290
311
|
} else {
|
|
312
|
+
// Buffer check
|
|
313
|
+
if (isBuffer(obj)) {
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
|
|
291
317
|
// Iterate over object keys
|
|
292
318
|
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
293
319
|
const len = keys.length;
|
|
@@ -301,6 +327,10 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
|
301
327
|
}
|
|
302
328
|
|
|
303
329
|
function findKey(obj, key) {
|
|
330
|
+
if (isBuffer(obj)){
|
|
331
|
+
return null;
|
|
332
|
+
}
|
|
333
|
+
|
|
304
334
|
key = key.toLowerCase();
|
|
305
335
|
const keys = Object.keys(obj);
|
|
306
336
|
let i = keys.length;
|
|
@@ -654,6 +684,11 @@ const toJSONObject = (obj) => {
|
|
|
654
684
|
return;
|
|
655
685
|
}
|
|
656
686
|
|
|
687
|
+
//Buffer check
|
|
688
|
+
if (isBuffer(source)) {
|
|
689
|
+
return source;
|
|
690
|
+
}
|
|
691
|
+
|
|
657
692
|
if(!('toJSON' in source)) {
|
|
658
693
|
stack[i] = source;
|
|
659
694
|
const target = isArray(source) ? [] : {};
|
|
@@ -725,6 +760,7 @@ const utils$1 = {
|
|
|
725
760
|
isBoolean,
|
|
726
761
|
isObject,
|
|
727
762
|
isPlainObject,
|
|
763
|
+
isEmptyObject,
|
|
728
764
|
isReadableStream,
|
|
729
765
|
isRequest,
|
|
730
766
|
isResponse,
|
|
@@ -1374,7 +1410,7 @@ const platform = {
|
|
|
1374
1410
|
};
|
|
1375
1411
|
|
|
1376
1412
|
function toURLEncodedForm(data, options) {
|
|
1377
|
-
return toFormData(data, new platform.classes.URLSearchParams(),
|
|
1413
|
+
return toFormData(data, new platform.classes.URLSearchParams(), {
|
|
1378
1414
|
visitor: function(value, key, path, helpers) {
|
|
1379
1415
|
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
1380
1416
|
this.append(key, value.toString('base64'));
|
|
@@ -1382,8 +1418,9 @@ function toURLEncodedForm(data, options) {
|
|
|
1382
1418
|
}
|
|
1383
1419
|
|
|
1384
1420
|
return helpers.defaultVisitor.apply(this, arguments);
|
|
1385
|
-
}
|
|
1386
|
-
|
|
1421
|
+
},
|
|
1422
|
+
...options
|
|
1423
|
+
});
|
|
1387
1424
|
}
|
|
1388
1425
|
|
|
1389
1426
|
/**
|
|
@@ -2106,7 +2143,7 @@ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
|
2106
2143
|
return requestedURL;
|
|
2107
2144
|
}
|
|
2108
2145
|
|
|
2109
|
-
const VERSION = "1.
|
|
2146
|
+
const VERSION = "1.11.0";
|
|
2110
2147
|
|
|
2111
2148
|
function parseProtocol(url) {
|
|
2112
2149
|
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
@@ -2534,7 +2571,7 @@ function throttle(fn, freq) {
|
|
|
2534
2571
|
clearTimeout(timer);
|
|
2535
2572
|
timer = null;
|
|
2536
2573
|
}
|
|
2537
|
-
fn
|
|
2574
|
+
fn(...args);
|
|
2538
2575
|
};
|
|
2539
2576
|
|
|
2540
2577
|
const throttled = (...args) => {
|
|
@@ -3408,7 +3445,7 @@ function mergeConfig(config1, config2) {
|
|
|
3408
3445
|
headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
|
|
3409
3446
|
};
|
|
3410
3447
|
|
|
3411
|
-
utils$1.forEach(Object.keys(
|
|
3448
|
+
utils$1.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
|
|
3412
3449
|
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
3413
3450
|
const configValue = merge(config1[prop], config2[prop], prop);
|
|
3414
3451
|
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
@@ -4386,8 +4423,8 @@ class Axios {
|
|
|
4386
4423
|
|
|
4387
4424
|
if (!synchronousRequestInterceptors) {
|
|
4388
4425
|
const chain = [dispatchRequest.bind(this), undefined];
|
|
4389
|
-
chain.unshift
|
|
4390
|
-
chain.push
|
|
4426
|
+
chain.unshift(...requestInterceptorChain);
|
|
4427
|
+
chain.push(...responseInterceptorChain);
|
|
4391
4428
|
len = chain.length;
|
|
4392
4429
|
|
|
4393
4430
|
promise = Promise.resolve(config);
|