axios 0.32.0 → 0.34.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 +163 -7
- package/README.md +70 -1
- package/dist/axios.js +242 -39
- 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 +242 -39
- 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/index.d.ts +5 -1
- package/lib/adapters/http.js +64 -11
- package/lib/adapters/xhr.js +12 -7
- package/lib/cancel/fromSignal.js +20 -0
- package/lib/core/Axios.js +82 -12
- package/lib/core/dispatchRequest.js +5 -4
- package/lib/core/mergeConfig.js +7 -0
- 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 +213 -2
- package/lib/helpers/toFormData.js +59 -10
- package/lib/utils.js +33 -3
- package/package.json +1 -1
package/dist/esm/axios.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// axios v0.
|
|
1
|
+
// axios v0.34.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);
|
|
@@ -396,6 +396,15 @@ function stripBOM(content) {
|
|
|
396
396
|
return content;
|
|
397
397
|
}
|
|
398
398
|
|
|
399
|
+
function defineOwnProperty(target, key, value) {
|
|
400
|
+
var descriptor = Object.create(null);
|
|
401
|
+
descriptor.value = value;
|
|
402
|
+
descriptor.writable = true;
|
|
403
|
+
descriptor.enumerable = true;
|
|
404
|
+
descriptor.configurable = true;
|
|
405
|
+
Object.defineProperty(target, key, descriptor);
|
|
406
|
+
}
|
|
407
|
+
|
|
399
408
|
/**
|
|
400
409
|
* Inherit the prototype methods from one constructor into another
|
|
401
410
|
* @param {function} constructor
|
|
@@ -403,14 +412,35 @@ function stripBOM(content) {
|
|
|
403
412
|
* @param {object} [props]
|
|
404
413
|
* @param {object} [descriptors]
|
|
405
414
|
*/
|
|
406
|
-
|
|
407
415
|
function inherits(constructor, superConstructor, props, descriptors) {
|
|
408
416
|
constructor.prototype = Object.create(
|
|
409
417
|
superConstructor.prototype,
|
|
410
418
|
descriptors
|
|
411
419
|
);
|
|
412
|
-
|
|
413
|
-
|
|
420
|
+
if (Object.prototype.hasOwnProperty.call(constructor.prototype, 'constructor')) {
|
|
421
|
+
constructor.prototype.constructor = constructor;
|
|
422
|
+
} else {
|
|
423
|
+
defineOwnProperty(constructor.prototype, 'constructor', constructor);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
if (props) {
|
|
427
|
+
var keys = Object.keys(props);
|
|
428
|
+
if (Object.getOwnPropertySymbols) {
|
|
429
|
+
keys = keys.concat(Object.getOwnPropertySymbols(props).filter(function(key) {
|
|
430
|
+
return Object.prototype.propertyIsEnumerable.call(props, key);
|
|
431
|
+
}));
|
|
432
|
+
}
|
|
433
|
+
keys.forEach(function(key) {
|
|
434
|
+
var value = props[key];
|
|
435
|
+
if (Object.prototype.hasOwnProperty.call(constructor.prototype, key)) {
|
|
436
|
+
constructor.prototype[key] = value;
|
|
437
|
+
} else {
|
|
438
|
+
// Assignment would invoke an inherited setter or fail on a read-only
|
|
439
|
+
// property installed by another library, such as Error.prototype.toJSON.
|
|
440
|
+
defineOwnProperty(constructor.prototype, key, value);
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
}
|
|
414
444
|
}
|
|
415
445
|
|
|
416
446
|
/**
|
|
@@ -773,6 +803,40 @@ function isSpecCompliant(thing) {
|
|
|
773
803
|
return thing && utils.isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator];
|
|
774
804
|
}
|
|
775
805
|
|
|
806
|
+
var UNSAFE_OPTION_KEYS = ['__proto__', 'constructor', 'prototype'];
|
|
807
|
+
|
|
808
|
+
// Materialises the serializer options onto a null-prototype object. Reading the
|
|
809
|
+
// options from a plain object let a polluted Object.prototype supply a visitor,
|
|
810
|
+
// a depth limit, a Blob implementation or key-format flags that the caller never
|
|
811
|
+
// asked for, and also let a polluted key mask an option the caller did set.
|
|
812
|
+
// Only own, defined properties of the caller's options are carried over.
|
|
813
|
+
function toFormDataOptions(source) {
|
|
814
|
+
var options = Object.create(null);
|
|
815
|
+
|
|
816
|
+
options.metaTokens = true;
|
|
817
|
+
options.dots = false;
|
|
818
|
+
options.indexes = false;
|
|
819
|
+
|
|
820
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
821
|
+
if (source == null) {
|
|
822
|
+
return options;
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
var names = Object.getOwnPropertyNames(source);
|
|
826
|
+
|
|
827
|
+
for (var i = 0; i < names.length; i++) {
|
|
828
|
+
var name = names[i];
|
|
829
|
+
|
|
830
|
+
if (UNSAFE_OPTION_KEYS.indexOf(name) !== -1 || utils.isUndefined(source[name])) {
|
|
831
|
+
continue;
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
options[name] = source[name];
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
return options;
|
|
838
|
+
}
|
|
839
|
+
|
|
776
840
|
/**
|
|
777
841
|
* Convert a data object to FormData
|
|
778
842
|
* @param {Object} obj
|
|
@@ -794,14 +858,7 @@ function toFormData(obj, formData, options) {
|
|
|
794
858
|
formData = formData || new (FormData$1 || FormData)();
|
|
795
859
|
|
|
796
860
|
// eslint-disable-next-line no-param-reassign
|
|
797
|
-
options =
|
|
798
|
-
metaTokens: true,
|
|
799
|
-
dots: false,
|
|
800
|
-
indexes: false
|
|
801
|
-
}, false, function defined(option, source) {
|
|
802
|
-
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
803
|
-
return !utils.isUndefined(source[option]);
|
|
804
|
-
});
|
|
861
|
+
options = toFormDataOptions(options);
|
|
805
862
|
|
|
806
863
|
var metaTokens = options.metaTokens;
|
|
807
864
|
// eslint-disable-next-line no-use-before-define
|
|
@@ -834,6 +891,29 @@ function toFormData(obj, formData, options) {
|
|
|
834
891
|
return value;
|
|
835
892
|
}
|
|
836
893
|
|
|
894
|
+
var stack = [];
|
|
895
|
+
|
|
896
|
+
function assertValueDepth(value, depth) {
|
|
897
|
+
if (depth > maxDepth) {
|
|
898
|
+
throw new AxiosError_1(
|
|
899
|
+
'Maximum object depth of ' + maxDepth + ' exceeded (got ' + depth + ' levels)',
|
|
900
|
+
AxiosError_1.ERR_FORM_DATA_DEPTH_EXCEEDED
|
|
901
|
+
);
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
if (!utils.isObject(value) || stack.indexOf(value) !== -1) {
|
|
905
|
+
return;
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
stack.push(value);
|
|
909
|
+
|
|
910
|
+
utils.forEach(value, function each(el) {
|
|
911
|
+
assertValueDepth(el, depth + 1);
|
|
912
|
+
});
|
|
913
|
+
|
|
914
|
+
stack.pop();
|
|
915
|
+
}
|
|
916
|
+
|
|
837
917
|
/**
|
|
838
918
|
*
|
|
839
919
|
* @param {*} value
|
|
@@ -849,6 +929,7 @@ function toFormData(obj, formData, options) {
|
|
|
849
929
|
if (utils.endsWith(key, '{}')) {
|
|
850
930
|
// eslint-disable-next-line no-param-reassign
|
|
851
931
|
key = metaTokens ? key : key.slice(0, -2);
|
|
932
|
+
assertValueDepth(value, 1);
|
|
852
933
|
// eslint-disable-next-line no-param-reassign
|
|
853
934
|
value = JSON.stringify(value);
|
|
854
935
|
} else if (
|
|
@@ -878,8 +959,6 @@ function toFormData(obj, formData, options) {
|
|
|
878
959
|
return false;
|
|
879
960
|
}
|
|
880
961
|
|
|
881
|
-
var stack = [];
|
|
882
|
-
|
|
883
962
|
var exposedHelpers = Object.assign(predicates, {
|
|
884
963
|
defaultVisitor: defaultVisitor,
|
|
885
964
|
convertValue: convertValue,
|
|
@@ -1006,9 +1085,17 @@ var buildURL = function buildURL(url, params, options) {
|
|
|
1006
1085
|
url = url.slice(0, hashmarkIndex);
|
|
1007
1086
|
}
|
|
1008
1087
|
|
|
1009
|
-
var _encode =
|
|
1088
|
+
var _encode = encode;
|
|
1089
|
+
var serializeFn;
|
|
1010
1090
|
|
|
1011
|
-
|
|
1091
|
+
if (options) {
|
|
1092
|
+
if (utils.isFunction(options)) {
|
|
1093
|
+
serializeFn = options;
|
|
1094
|
+
} else {
|
|
1095
|
+
_encode = utils.hasOwnProperty(options, 'encode') && options.encode || encode;
|
|
1096
|
+
serializeFn = utils.hasOwnProperty(options, 'serialize') ? options.serialize : undefined;
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1012
1099
|
|
|
1013
1100
|
var serializedParams;
|
|
1014
1101
|
|
|
@@ -1131,6 +1218,19 @@ var toURLEncodedForm = function toURLEncodedForm(data, options) {
|
|
|
1131
1218
|
}, options));
|
|
1132
1219
|
};
|
|
1133
1220
|
|
|
1221
|
+
var MAX_FORM_DATA_TO_JSON_DEPTH = 100;
|
|
1222
|
+
|
|
1223
|
+
function assertPathDepth(path) {
|
|
1224
|
+
var depth = path.length - 1;
|
|
1225
|
+
|
|
1226
|
+
if (depth > MAX_FORM_DATA_TO_JSON_DEPTH) {
|
|
1227
|
+
throw new AxiosError_1(
|
|
1228
|
+
'Maximum object depth of ' + MAX_FORM_DATA_TO_JSON_DEPTH + ' exceeded (got ' + depth + ' levels)',
|
|
1229
|
+
AxiosError_1.ERR_FORM_DATA_DEPTH_EXCEEDED
|
|
1230
|
+
);
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1134
1234
|
function parsePropPath(name) {
|
|
1135
1235
|
// foo[x][y][z]
|
|
1136
1236
|
// foo.x.y.z
|
|
@@ -1191,7 +1291,10 @@ function formDataToJSON(formData) {
|
|
|
1191
1291
|
var obj = {};
|
|
1192
1292
|
|
|
1193
1293
|
utils.forEachEntry(formData, function(name, value) {
|
|
1194
|
-
|
|
1294
|
+
var path = parsePropPath(name);
|
|
1295
|
+
|
|
1296
|
+
assertPathDepth(path);
|
|
1297
|
+
buildPath(path, value, obj, 0);
|
|
1195
1298
|
});
|
|
1196
1299
|
|
|
1197
1300
|
return obj;
|
|
@@ -1467,6 +1570,23 @@ utils.inherits(CanceledError, AxiosError_1, {
|
|
|
1467
1570
|
|
|
1468
1571
|
var CanceledError_1 = CanceledError;
|
|
1469
1572
|
|
|
1573
|
+
var fromSignal = function fromSignal(signal, config, request) {
|
|
1574
|
+
var error = new CanceledError_1(null, config, request);
|
|
1575
|
+
|
|
1576
|
+
if (signal) {
|
|
1577
|
+
try {
|
|
1578
|
+
var reason = signal.reason;
|
|
1579
|
+
if (reason !== undefined) {
|
|
1580
|
+
error.reason = reason;
|
|
1581
|
+
}
|
|
1582
|
+
} catch (e) {
|
|
1583
|
+
// A custom signal getter must not prevent cancellation.
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1587
|
+
return error;
|
|
1588
|
+
};
|
|
1589
|
+
|
|
1470
1590
|
var parseProtocol = function parseProtocol(url) {
|
|
1471
1591
|
var match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
1472
1592
|
return match && match[1] || '';
|
|
@@ -1499,10 +1619,11 @@ var xhr = function xhrAdapter(config) {
|
|
|
1499
1619
|
var request = new XMLHttpRequest();
|
|
1500
1620
|
|
|
1501
1621
|
// HTTP basic authentication
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
var
|
|
1505
|
-
|
|
1622
|
+
var configAuth = utils.hasOwnProperty(config, 'auth') ? config.auth : undefined;
|
|
1623
|
+
if (configAuth) {
|
|
1624
|
+
var username = utils.hasOwnProperty(configAuth, 'username') ? configAuth.username || '' : '';
|
|
1625
|
+
var password = utils.hasOwnProperty(configAuth, 'password') && configAuth.password
|
|
1626
|
+
? unescape(encodeURIComponent(configAuth.password))
|
|
1506
1627
|
: '';
|
|
1507
1628
|
requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
|
|
1508
1629
|
}
|
|
@@ -1515,7 +1636,11 @@ var xhr = function xhrAdapter(config) {
|
|
|
1515
1636
|
|
|
1516
1637
|
request.open(
|
|
1517
1638
|
config.method.toUpperCase(),
|
|
1518
|
-
buildURL(
|
|
1639
|
+
buildURL(
|
|
1640
|
+
fullPath,
|
|
1641
|
+
config.params,
|
|
1642
|
+
utils.hasOwnProperty(config, 'paramsSerializer') ? config.paramsSerializer : undefined
|
|
1643
|
+
),
|
|
1519
1644
|
true
|
|
1520
1645
|
);
|
|
1521
1646
|
|
|
@@ -1715,7 +1840,7 @@ var xhr = function xhrAdapter(config) {
|
|
|
1715
1840
|
}
|
|
1716
1841
|
reject(
|
|
1717
1842
|
!cancel || cancel.type
|
|
1718
|
-
?
|
|
1843
|
+
? fromSignal(config.signal, config, request)
|
|
1719
1844
|
: cancel
|
|
1720
1845
|
);
|
|
1721
1846
|
request.abort();
|
|
@@ -1979,7 +2104,7 @@ function throwIfCancellationRequested(config) {
|
|
|
1979
2104
|
}
|
|
1980
2105
|
|
|
1981
2106
|
if (config.signal && config.signal.aborted) {
|
|
1982
|
-
throw
|
|
2107
|
+
throw fromSignal(config.signal, config);
|
|
1983
2108
|
}
|
|
1984
2109
|
}
|
|
1985
2110
|
|
|
@@ -1992,8 +2117,9 @@ function throwIfCancellationRequested(config) {
|
|
|
1992
2117
|
var dispatchRequest = function dispatchRequest(config) {
|
|
1993
2118
|
throwIfCancellationRequested(config);
|
|
1994
2119
|
|
|
1995
|
-
// Ensure headers exist
|
|
1996
|
-
|
|
2120
|
+
// Ensure headers exist. A request interceptor may return a replacement config
|
|
2121
|
+
// that inherits from Object.prototype, so only an own headers value is used.
|
|
2122
|
+
config.headers = (utils.hasOwnProperty(config, 'headers') && config.headers) || {};
|
|
1997
2123
|
|
|
1998
2124
|
// Transform request data
|
|
1999
2125
|
config.data = transformData.call(
|
|
@@ -2126,6 +2252,11 @@ var mergeConfig = function mergeConfig(config1, config2) {
|
|
|
2126
2252
|
}
|
|
2127
2253
|
}
|
|
2128
2254
|
|
|
2255
|
+
function defaultToConfig2Reference(prop) {
|
|
2256
|
+
var value = getOwn(config2, prop);
|
|
2257
|
+
return utils.isUndefined(value) ? getOwn(config1, prop) : value;
|
|
2258
|
+
}
|
|
2259
|
+
|
|
2129
2260
|
// eslint-disable-next-line consistent-return
|
|
2130
2261
|
function mergeDirectKeys(prop) {
|
|
2131
2262
|
if (hasOwn(config2, prop)) {
|
|
@@ -2161,6 +2292,8 @@ var mergeConfig = function mergeConfig(config1, config2) {
|
|
|
2161
2292
|
'httpAgent': defaultToConfig2,
|
|
2162
2293
|
'httpsAgent': defaultToConfig2,
|
|
2163
2294
|
'cancelToken': defaultToConfig2,
|
|
2295
|
+
// Signals are live objects; cloning them snapshots getters and reasons.
|
|
2296
|
+
'signal': defaultToConfig2Reference,
|
|
2164
2297
|
'socketPath': defaultToConfig2,
|
|
2165
2298
|
'allowedSocketPaths': defaultToConfig2,
|
|
2166
2299
|
'responseEncoding': defaultToConfig2,
|
|
@@ -2180,7 +2313,7 @@ var mergeConfig = function mergeConfig(config1, config2) {
|
|
|
2180
2313
|
};
|
|
2181
2314
|
|
|
2182
2315
|
var data = {
|
|
2183
|
-
"version": "0.
|
|
2316
|
+
"version": "0.34.0"
|
|
2184
2317
|
};
|
|
2185
2318
|
|
|
2186
2319
|
var VERSION = data.version;
|
|
@@ -2269,6 +2402,56 @@ var validator = {
|
|
|
2269
2402
|
};
|
|
2270
2403
|
|
|
2271
2404
|
var validators = validator.validators;
|
|
2405
|
+
|
|
2406
|
+
function captureCallerStack(boundary) {
|
|
2407
|
+
var caller = {};
|
|
2408
|
+
try {
|
|
2409
|
+
if (Error.captureStackTrace) {
|
|
2410
|
+
Error.captureStackTrace(caller, boundary);
|
|
2411
|
+
} else {
|
|
2412
|
+
caller = new Error();
|
|
2413
|
+
}
|
|
2414
|
+
} catch (e) {
|
|
2415
|
+
// Stack hooks must not prevent a request from being sent.
|
|
2416
|
+
}
|
|
2417
|
+
return caller;
|
|
2418
|
+
}
|
|
2419
|
+
|
|
2420
|
+
function attachCallerStack(promise, caller) {
|
|
2421
|
+
if (!caller) {
|
|
2422
|
+
return promise;
|
|
2423
|
+
}
|
|
2424
|
+
|
|
2425
|
+
return promise.then(null, function onRequestRejected(error) {
|
|
2426
|
+
try {
|
|
2427
|
+
if (error instanceof Error || Object.prototype.toString.call(error) === '[object Error]') {
|
|
2428
|
+
// Capture at dispatch time, but only format the stack on failure.
|
|
2429
|
+
// Capturing in this callback would lose callers using .then/.catch.
|
|
2430
|
+
var stack = caller.stack;
|
|
2431
|
+
if (typeof stack === 'string') {
|
|
2432
|
+
var newline = stack.indexOf('\n');
|
|
2433
|
+
stack = newline === -1 ? '' : stack.slice(newline + 1);
|
|
2434
|
+
var original = error.stack;
|
|
2435
|
+
if (stack && (original === undefined || original === null || original === '')) {
|
|
2436
|
+
error.stack = stack;
|
|
2437
|
+
} else if (stack && typeof original === 'string' && original.indexOf(stack) === -1) {
|
|
2438
|
+
error.stack = original + '\n' + stack;
|
|
2439
|
+
}
|
|
2440
|
+
}
|
|
2441
|
+
}
|
|
2442
|
+
} catch (e) {
|
|
2443
|
+
// Frozen errors and custom stack accessors must retain their rejection.
|
|
2444
|
+
}
|
|
2445
|
+
return Promise.reject(error);
|
|
2446
|
+
});
|
|
2447
|
+
}
|
|
2448
|
+
|
|
2449
|
+
function dispatchAfterRecovery(config) {
|
|
2450
|
+
return function dispatchRecoveredRequest() {
|
|
2451
|
+
return dispatchRequest(config);
|
|
2452
|
+
};
|
|
2453
|
+
}
|
|
2454
|
+
|
|
2272
2455
|
/**
|
|
2273
2456
|
* Create a new instance of Axios
|
|
2274
2457
|
*
|
|
@@ -2299,11 +2482,14 @@ Axios.prototype.request = function request(configOrUrl, config) {
|
|
|
2299
2482
|
}
|
|
2300
2483
|
|
|
2301
2484
|
config = mergeConfig(this.defaults, config);
|
|
2485
|
+
var caller = config.captureCallerStack === true ? captureCallerStack(request) : null;
|
|
2302
2486
|
|
|
2303
|
-
// Set config.method
|
|
2487
|
+
// Set config.method. The merged config is null-prototype, but instance
|
|
2488
|
+
// defaults may be an ordinary object, so the fallback is read as an own
|
|
2489
|
+
// property to keep an inherited value from choosing the request method.
|
|
2304
2490
|
if (config.method) {
|
|
2305
2491
|
config.method = config.method.toLowerCase();
|
|
2306
|
-
} else if (this.defaults.method) {
|
|
2492
|
+
} else if (utils.hasOwnProperty(this.defaults, 'method') && this.defaults.method) {
|
|
2307
2493
|
config.method = this.defaults.method.toLowerCase();
|
|
2308
2494
|
} else {
|
|
2309
2495
|
config.method = 'get';
|
|
@@ -2365,7 +2551,7 @@ Axios.prototype.request = function request(configOrUrl, config) {
|
|
|
2365
2551
|
promise = promise.then(chain.shift(), chain.shift());
|
|
2366
2552
|
}
|
|
2367
2553
|
|
|
2368
|
-
return promise;
|
|
2554
|
+
return attachCallerStack(promise, caller);
|
|
2369
2555
|
}
|
|
2370
2556
|
|
|
2371
2557
|
|
|
@@ -2374,24 +2560,39 @@ Axios.prototype.request = function request(configOrUrl, config) {
|
|
|
2374
2560
|
var onFulfilled = requestInterceptorChain.shift();
|
|
2375
2561
|
var onRejected = requestInterceptorChain.shift();
|
|
2376
2562
|
try {
|
|
2377
|
-
newConfig = onFulfilled(newConfig);
|
|
2563
|
+
newConfig = onFulfilled ? onFulfilled(newConfig) : newConfig;
|
|
2378
2564
|
} catch (error) {
|
|
2379
|
-
onRejected
|
|
2565
|
+
if (!onRejected) {
|
|
2566
|
+
promise = Promise.reject(error);
|
|
2567
|
+
break;
|
|
2568
|
+
}
|
|
2569
|
+
try {
|
|
2570
|
+
var recovery = onRejected(error);
|
|
2571
|
+
if (recovery && typeof recovery.then === 'function') {
|
|
2572
|
+
promise = Promise.resolve(recovery).then(dispatchAfterRecovery(newConfig));
|
|
2573
|
+
}
|
|
2574
|
+
} catch (rejectedError) {
|
|
2575
|
+
promise = Promise.reject(rejectedError);
|
|
2576
|
+
}
|
|
2380
2577
|
break;
|
|
2381
2578
|
}
|
|
2382
2579
|
}
|
|
2383
2580
|
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2581
|
+
if (!promise) {
|
|
2582
|
+
try {
|
|
2583
|
+
promise = dispatchRequest(newConfig);
|
|
2584
|
+
} catch (error) {
|
|
2585
|
+
// Dispatch errors, including pre-aborted signals, still go through the
|
|
2586
|
+
// response interceptors registered below.
|
|
2587
|
+
promise = Promise.reject(error);
|
|
2588
|
+
}
|
|
2388
2589
|
}
|
|
2389
2590
|
|
|
2390
2591
|
while (responseInterceptorChain.length) {
|
|
2391
2592
|
promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift());
|
|
2392
2593
|
}
|
|
2393
2594
|
|
|
2394
|
-
return promise;
|
|
2595
|
+
return attachCallerStack(promise, caller);
|
|
2395
2596
|
};
|
|
2396
2597
|
|
|
2397
2598
|
Axios.prototype.getUri = function getUri(config) {
|
|
@@ -2404,10 +2605,12 @@ Axios.prototype.getUri = function getUri(config) {
|
|
|
2404
2605
|
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
|
2405
2606
|
/*eslint func-names:0*/
|
|
2406
2607
|
Axios.prototype[method] = function(url, config) {
|
|
2407
|
-
|
|
2608
|
+
var requestConfig = config || {};
|
|
2609
|
+
|
|
2610
|
+
return this.request(mergeConfig(requestConfig, {
|
|
2408
2611
|
method: method,
|
|
2409
2612
|
url: url,
|
|
2410
|
-
data: (
|
|
2613
|
+
data: utils.hasOwnProperty(requestConfig, 'data') ? requestConfig.data : undefined
|
|
2411
2614
|
}));
|
|
2412
2615
|
};
|
|
2413
2616
|
});
|