axios 0.32.0 → 0.33.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 +143 -7
- package/dist/axios.js +67 -14
- package/dist/axios.js.map +1 -1
- package/dist/axios.min.js +1 -1
- package/dist/axios.min.js.map +1 -1
- package/dist/esm/axios.js +67 -14
- package/dist/esm/axios.js.map +1 -1
- package/dist/esm/axios.min.js +1 -1
- package/dist/esm/axios.min.js.map +1 -1
- package/lib/adapters/http.js +10 -6
- package/lib/adapters/xhr.js +10 -5
- package/lib/core/Axios.js +4 -2
- package/lib/env/data.js +1 -1
- package/lib/helpers/buildURL.js +11 -3
- package/lib/helpers/formDataToJSON.js +18 -1
- package/lib/helpers/shouldBypassProxy.js +1 -1
- package/lib/helpers/toFormData.js +24 -2
- package/package.json +1 -1
package/dist/esm/axios.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// axios v0.
|
|
1
|
+
// axios v0.33.0 Copyright (c) 2026 Matt Zabriskie
|
|
2
2
|
var bind = function bind(fn, thisArg) {
|
|
3
3
|
return function wrap() {
|
|
4
4
|
return fn.apply(thisArg, arguments);
|
|
@@ -834,6 +834,29 @@ function toFormData(obj, formData, options) {
|
|
|
834
834
|
return value;
|
|
835
835
|
}
|
|
836
836
|
|
|
837
|
+
var stack = [];
|
|
838
|
+
|
|
839
|
+
function assertValueDepth(value, depth) {
|
|
840
|
+
if (depth > maxDepth) {
|
|
841
|
+
throw new AxiosError_1(
|
|
842
|
+
'Maximum object depth of ' + maxDepth + ' exceeded (got ' + depth + ' levels)',
|
|
843
|
+
AxiosError_1.ERR_FORM_DATA_DEPTH_EXCEEDED
|
|
844
|
+
);
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
if (!utils.isObject(value) || stack.indexOf(value) !== -1) {
|
|
848
|
+
return;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
stack.push(value);
|
|
852
|
+
|
|
853
|
+
utils.forEach(value, function each(el) {
|
|
854
|
+
assertValueDepth(el, depth + 1);
|
|
855
|
+
});
|
|
856
|
+
|
|
857
|
+
stack.pop();
|
|
858
|
+
}
|
|
859
|
+
|
|
837
860
|
/**
|
|
838
861
|
*
|
|
839
862
|
* @param {*} value
|
|
@@ -849,6 +872,7 @@ function toFormData(obj, formData, options) {
|
|
|
849
872
|
if (utils.endsWith(key, '{}')) {
|
|
850
873
|
// eslint-disable-next-line no-param-reassign
|
|
851
874
|
key = metaTokens ? key : key.slice(0, -2);
|
|
875
|
+
assertValueDepth(value, 1);
|
|
852
876
|
// eslint-disable-next-line no-param-reassign
|
|
853
877
|
value = JSON.stringify(value);
|
|
854
878
|
} else if (
|
|
@@ -878,8 +902,6 @@ function toFormData(obj, formData, options) {
|
|
|
878
902
|
return false;
|
|
879
903
|
}
|
|
880
904
|
|
|
881
|
-
var stack = [];
|
|
882
|
-
|
|
883
905
|
var exposedHelpers = Object.assign(predicates, {
|
|
884
906
|
defaultVisitor: defaultVisitor,
|
|
885
907
|
convertValue: convertValue,
|
|
@@ -1006,9 +1028,17 @@ var buildURL = function buildURL(url, params, options) {
|
|
|
1006
1028
|
url = url.slice(0, hashmarkIndex);
|
|
1007
1029
|
}
|
|
1008
1030
|
|
|
1009
|
-
var _encode =
|
|
1031
|
+
var _encode = encode;
|
|
1032
|
+
var serializeFn;
|
|
1010
1033
|
|
|
1011
|
-
|
|
1034
|
+
if (options) {
|
|
1035
|
+
if (utils.isFunction(options)) {
|
|
1036
|
+
serializeFn = options;
|
|
1037
|
+
} else {
|
|
1038
|
+
_encode = utils.hasOwnProperty(options, 'encode') && options.encode || encode;
|
|
1039
|
+
serializeFn = utils.hasOwnProperty(options, 'serialize') ? options.serialize : undefined;
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1012
1042
|
|
|
1013
1043
|
var serializedParams;
|
|
1014
1044
|
|
|
@@ -1131,6 +1161,19 @@ var toURLEncodedForm = function toURLEncodedForm(data, options) {
|
|
|
1131
1161
|
}, options));
|
|
1132
1162
|
};
|
|
1133
1163
|
|
|
1164
|
+
var MAX_FORM_DATA_TO_JSON_DEPTH = 100;
|
|
1165
|
+
|
|
1166
|
+
function assertPathDepth(path) {
|
|
1167
|
+
var depth = path.length - 1;
|
|
1168
|
+
|
|
1169
|
+
if (depth > MAX_FORM_DATA_TO_JSON_DEPTH) {
|
|
1170
|
+
throw new AxiosError_1(
|
|
1171
|
+
'Maximum object depth of ' + MAX_FORM_DATA_TO_JSON_DEPTH + ' exceeded (got ' + depth + ' levels)',
|
|
1172
|
+
AxiosError_1.ERR_FORM_DATA_DEPTH_EXCEEDED
|
|
1173
|
+
);
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1134
1177
|
function parsePropPath(name) {
|
|
1135
1178
|
// foo[x][y][z]
|
|
1136
1179
|
// foo.x.y.z
|
|
@@ -1191,7 +1234,10 @@ function formDataToJSON(formData) {
|
|
|
1191
1234
|
var obj = {};
|
|
1192
1235
|
|
|
1193
1236
|
utils.forEachEntry(formData, function(name, value) {
|
|
1194
|
-
|
|
1237
|
+
var path = parsePropPath(name);
|
|
1238
|
+
|
|
1239
|
+
assertPathDepth(path);
|
|
1240
|
+
buildPath(path, value, obj, 0);
|
|
1195
1241
|
});
|
|
1196
1242
|
|
|
1197
1243
|
return obj;
|
|
@@ -1499,10 +1545,11 @@ var xhr = function xhrAdapter(config) {
|
|
|
1499
1545
|
var request = new XMLHttpRequest();
|
|
1500
1546
|
|
|
1501
1547
|
// HTTP basic authentication
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
var
|
|
1505
|
-
|
|
1548
|
+
var configAuth = utils.hasOwnProperty(config, 'auth') ? config.auth : undefined;
|
|
1549
|
+
if (configAuth) {
|
|
1550
|
+
var username = utils.hasOwnProperty(configAuth, 'username') ? configAuth.username || '' : '';
|
|
1551
|
+
var password = utils.hasOwnProperty(configAuth, 'password') && configAuth.password
|
|
1552
|
+
? unescape(encodeURIComponent(configAuth.password))
|
|
1506
1553
|
: '';
|
|
1507
1554
|
requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
|
|
1508
1555
|
}
|
|
@@ -1515,7 +1562,11 @@ var xhr = function xhrAdapter(config) {
|
|
|
1515
1562
|
|
|
1516
1563
|
request.open(
|
|
1517
1564
|
config.method.toUpperCase(),
|
|
1518
|
-
buildURL(
|
|
1565
|
+
buildURL(
|
|
1566
|
+
fullPath,
|
|
1567
|
+
config.params,
|
|
1568
|
+
utils.hasOwnProperty(config, 'paramsSerializer') ? config.paramsSerializer : undefined
|
|
1569
|
+
),
|
|
1519
1570
|
true
|
|
1520
1571
|
);
|
|
1521
1572
|
|
|
@@ -2180,7 +2231,7 @@ var mergeConfig = function mergeConfig(config1, config2) {
|
|
|
2180
2231
|
};
|
|
2181
2232
|
|
|
2182
2233
|
var data = {
|
|
2183
|
-
"version": "0.
|
|
2234
|
+
"version": "0.33.0"
|
|
2184
2235
|
};
|
|
2185
2236
|
|
|
2186
2237
|
var VERSION = data.version;
|
|
@@ -2404,10 +2455,12 @@ Axios.prototype.getUri = function getUri(config) {
|
|
|
2404
2455
|
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
|
2405
2456
|
/*eslint func-names:0*/
|
|
2406
2457
|
Axios.prototype[method] = function(url, config) {
|
|
2407
|
-
|
|
2458
|
+
var requestConfig = config || {};
|
|
2459
|
+
|
|
2460
|
+
return this.request(mergeConfig(requestConfig, {
|
|
2408
2461
|
method: method,
|
|
2409
2462
|
url: url,
|
|
2410
|
-
data: (
|
|
2463
|
+
data: utils.hasOwnProperty(requestConfig, 'data') ? requestConfig.data : undefined
|
|
2411
2464
|
}));
|
|
2412
2465
|
};
|
|
2413
2466
|
});
|