axios 1.13.2 → 1.13.3
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 +67 -0
- package/MIGRATION_GUIDE.md +876 -2
- package/README.md +138 -80
- package/dist/axios.js +253 -150
- 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 +152 -168
- package/dist/browser/axios.cjs.map +1 -1
- package/dist/esm/axios.js +152 -168
- 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 +187 -200
- package/dist/node/axios.cjs.map +1 -1
- package/index.d.cts +21 -3
- package/index.d.ts +27 -7
- package/lib/adapters/README.md +1 -1
- package/lib/adapters/http.js +13 -10
- package/lib/adapters/xhr.js +2 -2
- package/lib/cancel/CanceledError.js +15 -18
- package/lib/core/Axios.js +8 -3
- package/lib/core/AxiosError.js +65 -102
- package/lib/core/InterceptorManager.js +2 -1
- package/lib/core/mergeConfig.js +2 -3
- package/lib/core/transformData.js +1 -1
- package/lib/env/data.js +1 -1
- package/lib/helpers/buildURL.js +7 -10
- package/lib/helpers/composeSignals.js +1 -1
- package/lib/helpers/cookies.js +1 -1
- package/lib/helpers/isAxiosError.js +1 -1
- package/lib/helpers/parseHeaders.js +1 -1
- package/lib/helpers/spread.js +1 -1
- package/lib/utils.js +24 -7
- package/package.json +26 -2
package/dist/esm/axios.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Axios v1.13.
|
|
1
|
+
/*! Axios v1.13.3 Copyright (c) 2026 Matt Zabriskie and contributors */
|
|
2
2
|
/**
|
|
3
3
|
* Create a bound version of a function with a specified `this` context
|
|
4
4
|
*
|
|
@@ -262,10 +262,11 @@ const trim = (str) => str.trim ?
|
|
|
262
262
|
* If 'obj' is an Object callback will be called passing
|
|
263
263
|
* the value, key, and complete object for each property.
|
|
264
264
|
*
|
|
265
|
-
* @param {Object|Array} obj The object to iterate
|
|
265
|
+
* @param {Object|Array<unknown>} obj The object to iterate
|
|
266
266
|
* @param {Function} fn The callback to invoke for each item
|
|
267
267
|
*
|
|
268
|
-
* @param {
|
|
268
|
+
* @param {Object} [options]
|
|
269
|
+
* @param {Boolean} [options.allOwnKeys = false]
|
|
269
270
|
* @returns {any}
|
|
270
271
|
*/
|
|
271
272
|
function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
@@ -342,7 +343,7 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
|
|
|
342
343
|
* Example:
|
|
343
344
|
*
|
|
344
345
|
* ```js
|
|
345
|
-
*
|
|
346
|
+
* const result = merge({foo: 123}, {foo: 456});
|
|
346
347
|
* console.log(result.foo); // outputs 456
|
|
347
348
|
* ```
|
|
348
349
|
*
|
|
@@ -379,15 +380,26 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
379
380
|
* @param {Object} b The object to copy properties from
|
|
380
381
|
* @param {Object} thisArg The object to bind function to
|
|
381
382
|
*
|
|
382
|
-
* @param {
|
|
383
|
+
* @param {Object} [options]
|
|
384
|
+
* @param {Boolean} [options.allOwnKeys]
|
|
383
385
|
* @returns {Object} The resulting value of object a
|
|
384
386
|
*/
|
|
385
387
|
const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
|
|
386
388
|
forEach(b, (val, key) => {
|
|
387
389
|
if (thisArg && isFunction$1(val)) {
|
|
388
|
-
a
|
|
390
|
+
Object.defineProperty(a, key, {
|
|
391
|
+
value: bind(val, thisArg),
|
|
392
|
+
writable: true,
|
|
393
|
+
enumerable: true,
|
|
394
|
+
configurable: true
|
|
395
|
+
});
|
|
389
396
|
} else {
|
|
390
|
-
a
|
|
397
|
+
Object.defineProperty(a, key, {
|
|
398
|
+
value: val,
|
|
399
|
+
writable: true,
|
|
400
|
+
enumerable: true,
|
|
401
|
+
configurable: true
|
|
402
|
+
});
|
|
391
403
|
}
|
|
392
404
|
}, {allOwnKeys});
|
|
393
405
|
return a;
|
|
@@ -418,7 +430,12 @@ const stripBOM = (content) => {
|
|
|
418
430
|
*/
|
|
419
431
|
const inherits = (constructor, superConstructor, props, descriptors) => {
|
|
420
432
|
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
|
421
|
-
constructor.prototype
|
|
433
|
+
Object.defineProperty(constructor.prototype, 'constructor', {
|
|
434
|
+
value: constructor,
|
|
435
|
+
writable: true,
|
|
436
|
+
enumerable: false,
|
|
437
|
+
configurable: true
|
|
438
|
+
});
|
|
422
439
|
Object.defineProperty(constructor, 'super', {
|
|
423
440
|
value: superConstructor.prototype
|
|
424
441
|
});
|
|
@@ -791,110 +808,75 @@ const utils$1 = {
|
|
|
791
808
|
isIterable
|
|
792
809
|
};
|
|
793
810
|
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
811
|
+
class AxiosError$1 extends Error {
|
|
812
|
+
static from(error, code, config, request, response, customProps) {
|
|
813
|
+
const axiosError = new AxiosError$1(error.message, code || error.code, config, request, response);
|
|
814
|
+
axiosError.cause = error;
|
|
815
|
+
axiosError.name = error.name;
|
|
816
|
+
customProps && Object.assign(axiosError, customProps);
|
|
817
|
+
return axiosError;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
/**
|
|
821
|
+
* Create an Error with the specified message, config, error code, request and response.
|
|
822
|
+
*
|
|
823
|
+
* @param {string} message The error message.
|
|
824
|
+
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
825
|
+
* @param {Object} [config] The config.
|
|
826
|
+
* @param {Object} [request] The request.
|
|
827
|
+
* @param {Object} [response] The response.
|
|
828
|
+
*
|
|
829
|
+
* @returns {Error} The created error.
|
|
830
|
+
*/
|
|
831
|
+
constructor(message, code, config, request, response) {
|
|
832
|
+
super(message);
|
|
833
|
+
this.name = 'AxiosError';
|
|
834
|
+
this.isAxiosError = true;
|
|
835
|
+
code && (this.code = code);
|
|
836
|
+
config && (this.config = config);
|
|
837
|
+
request && (this.request = request);
|
|
838
|
+
if (response) {
|
|
839
|
+
this.response = response;
|
|
840
|
+
this.status = response.status;
|
|
841
|
+
}
|
|
842
|
+
}
|
|
813
843
|
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
844
|
+
toJSON() {
|
|
845
|
+
return {
|
|
846
|
+
// Standard
|
|
847
|
+
message: this.message,
|
|
848
|
+
name: this.name,
|
|
849
|
+
// Microsoft
|
|
850
|
+
description: this.description,
|
|
851
|
+
number: this.number,
|
|
852
|
+
// Mozilla
|
|
853
|
+
fileName: this.fileName,
|
|
854
|
+
lineNumber: this.lineNumber,
|
|
855
|
+
columnNumber: this.columnNumber,
|
|
856
|
+
stack: this.stack,
|
|
857
|
+
// Axios
|
|
858
|
+
config: utils$1.toJSONObject(this.config),
|
|
859
|
+
code: this.code,
|
|
860
|
+
status: this.status,
|
|
861
|
+
};
|
|
862
|
+
}
|
|
823
863
|
}
|
|
824
864
|
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
config: utils$1.toJSONObject(this.config),
|
|
841
|
-
code: this.code,
|
|
842
|
-
status: this.status
|
|
843
|
-
};
|
|
844
|
-
}
|
|
845
|
-
});
|
|
846
|
-
|
|
847
|
-
const prototype$1 = AxiosError$1.prototype;
|
|
848
|
-
const descriptors = {};
|
|
849
|
-
|
|
850
|
-
[
|
|
851
|
-
'ERR_BAD_OPTION_VALUE',
|
|
852
|
-
'ERR_BAD_OPTION',
|
|
853
|
-
'ECONNABORTED',
|
|
854
|
-
'ETIMEDOUT',
|
|
855
|
-
'ERR_NETWORK',
|
|
856
|
-
'ERR_FR_TOO_MANY_REDIRECTS',
|
|
857
|
-
'ERR_DEPRECATED',
|
|
858
|
-
'ERR_BAD_RESPONSE',
|
|
859
|
-
'ERR_BAD_REQUEST',
|
|
860
|
-
'ERR_CANCELED',
|
|
861
|
-
'ERR_NOT_SUPPORT',
|
|
862
|
-
'ERR_INVALID_URL'
|
|
863
|
-
// eslint-disable-next-line func-names
|
|
864
|
-
].forEach(code => {
|
|
865
|
-
descriptors[code] = {value: code};
|
|
866
|
-
});
|
|
867
|
-
|
|
868
|
-
Object.defineProperties(AxiosError$1, descriptors);
|
|
869
|
-
Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
|
|
870
|
-
|
|
871
|
-
// eslint-disable-next-line func-names
|
|
872
|
-
AxiosError$1.from = (error, code, config, request, response, customProps) => {
|
|
873
|
-
const axiosError = Object.create(prototype$1);
|
|
874
|
-
|
|
875
|
-
utils$1.toFlatObject(error, axiosError, function filter(obj) {
|
|
876
|
-
return obj !== Error.prototype;
|
|
877
|
-
}, prop => {
|
|
878
|
-
return prop !== 'isAxiosError';
|
|
879
|
-
});
|
|
880
|
-
|
|
881
|
-
const msg = error && error.message ? error.message : 'Error';
|
|
882
|
-
|
|
883
|
-
// Prefer explicit code; otherwise copy the low-level error's code (e.g. ECONNREFUSED)
|
|
884
|
-
const errCode = code == null && error ? error.code : code;
|
|
885
|
-
AxiosError$1.call(axiosError, msg, errCode, config, request, response);
|
|
886
|
-
|
|
887
|
-
// Chain the original error on the standard field; non-enumerable to avoid JSON noise
|
|
888
|
-
if (error && axiosError.cause == null) {
|
|
889
|
-
Object.defineProperty(axiosError, 'cause', { value: error, configurable: true });
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
axiosError.name = (error && error.name) || 'Error';
|
|
893
|
-
|
|
894
|
-
customProps && Object.assign(axiosError, customProps);
|
|
895
|
-
|
|
896
|
-
return axiosError;
|
|
897
|
-
};
|
|
865
|
+
// This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
|
|
866
|
+
AxiosError$1.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
|
|
867
|
+
AxiosError$1.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
|
|
868
|
+
AxiosError$1.ECONNABORTED = 'ECONNABORTED';
|
|
869
|
+
AxiosError$1.ETIMEDOUT = 'ETIMEDOUT';
|
|
870
|
+
AxiosError$1.ERR_NETWORK = 'ERR_NETWORK';
|
|
871
|
+
AxiosError$1.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
|
|
872
|
+
AxiosError$1.ERR_DEPRECATED = 'ERR_DEPRECATED';
|
|
873
|
+
AxiosError$1.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
|
|
874
|
+
AxiosError$1.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
|
|
875
|
+
AxiosError$1.ERR_CANCELED = 'ERR_CANCELED';
|
|
876
|
+
AxiosError$1.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
|
|
877
|
+
AxiosError$1.ERR_INVALID_URL = 'ERR_INVALID_URL';
|
|
878
|
+
|
|
879
|
+
const AxiosError$2 = AxiosError$1;
|
|
898
880
|
|
|
899
881
|
// eslint-disable-next-line strict
|
|
900
882
|
const httpAdapter = null;
|
|
@@ -1019,7 +1001,7 @@ function toFormData$1(obj, formData, options) {
|
|
|
1019
1001
|
}
|
|
1020
1002
|
|
|
1021
1003
|
if (!useBlob && utils$1.isBlob(value)) {
|
|
1022
|
-
throw new AxiosError$
|
|
1004
|
+
throw new AxiosError$2('Blob is not supported. Use a Buffer instead.');
|
|
1023
1005
|
}
|
|
1024
1006
|
|
|
1025
1007
|
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
|
|
@@ -1193,29 +1175,26 @@ function encode(val) {
|
|
|
1193
1175
|
* @returns {string} The formatted url
|
|
1194
1176
|
*/
|
|
1195
1177
|
function buildURL(url, params, options) {
|
|
1196
|
-
/*eslint no-param-reassign:0*/
|
|
1197
1178
|
if (!params) {
|
|
1198
1179
|
return url;
|
|
1199
1180
|
}
|
|
1200
|
-
|
|
1181
|
+
|
|
1201
1182
|
const _encode = options && options.encode || encode;
|
|
1202
1183
|
|
|
1203
|
-
|
|
1204
|
-
options
|
|
1205
|
-
|
|
1206
|
-
};
|
|
1207
|
-
}
|
|
1184
|
+
const _options = utils$1.isFunction(options) ? {
|
|
1185
|
+
serialize: options
|
|
1186
|
+
} : options;
|
|
1208
1187
|
|
|
1209
|
-
const serializeFn =
|
|
1188
|
+
const serializeFn = _options && _options.serialize;
|
|
1210
1189
|
|
|
1211
1190
|
let serializedParams;
|
|
1212
1191
|
|
|
1213
1192
|
if (serializeFn) {
|
|
1214
|
-
serializedParams = serializeFn(params,
|
|
1193
|
+
serializedParams = serializeFn(params, _options);
|
|
1215
1194
|
} else {
|
|
1216
1195
|
serializedParams = utils$1.isURLSearchParams(params) ?
|
|
1217
1196
|
params.toString() :
|
|
1218
|
-
new AxiosURLSearchParams(params,
|
|
1197
|
+
new AxiosURLSearchParams(params, _options).toString(_encode);
|
|
1219
1198
|
}
|
|
1220
1199
|
|
|
1221
1200
|
if (serializedParams) {
|
|
@@ -1240,6 +1219,7 @@ class InterceptorManager {
|
|
|
1240
1219
|
*
|
|
1241
1220
|
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
1242
1221
|
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
1222
|
+
* @param {Object} options The options for the interceptor, synchronous and runWhen
|
|
1243
1223
|
*
|
|
1244
1224
|
* @return {Number} An ID used to remove interceptor later
|
|
1245
1225
|
*/
|
|
@@ -1589,7 +1569,7 @@ const defaults = {
|
|
|
1589
1569
|
} catch (e) {
|
|
1590
1570
|
if (strictJSONParsing) {
|
|
1591
1571
|
if (e.name === 'SyntaxError') {
|
|
1592
|
-
throw AxiosError$
|
|
1572
|
+
throw AxiosError$2.from(e, AxiosError$2.ERR_BAD_RESPONSE, this, null, this.response);
|
|
1593
1573
|
}
|
|
1594
1574
|
throw e;
|
|
1595
1575
|
}
|
|
@@ -2023,24 +2003,24 @@ function isCancel$1(value) {
|
|
|
2023
2003
|
return !!(value && value.__CANCEL__);
|
|
2024
2004
|
}
|
|
2025
2005
|
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2006
|
+
class CanceledError$1 extends AxiosError$2 {
|
|
2007
|
+
/**
|
|
2008
|
+
* A `CanceledError` is an object that is thrown when an operation is canceled.
|
|
2009
|
+
*
|
|
2010
|
+
* @param {string=} message The message.
|
|
2011
|
+
* @param {Object=} config The config.
|
|
2012
|
+
* @param {Object=} request The request.
|
|
2013
|
+
*
|
|
2014
|
+
* @returns {CanceledError} The created error.
|
|
2015
|
+
*/
|
|
2016
|
+
constructor(message, config, request) {
|
|
2017
|
+
super(message == null ? 'canceled' : message, AxiosError$2.ERR_CANCELED, config, request);
|
|
2018
|
+
this.name = 'CanceledError';
|
|
2019
|
+
this.__CANCEL__ = true;
|
|
2020
|
+
}
|
|
2039
2021
|
}
|
|
2040
2022
|
|
|
2041
|
-
|
|
2042
|
-
__CANCEL__: true
|
|
2043
|
-
});
|
|
2023
|
+
const CanceledError$2 = CanceledError$1;
|
|
2044
2024
|
|
|
2045
2025
|
/**
|
|
2046
2026
|
* Resolve or reject a Promise based on response status.
|
|
@@ -2056,9 +2036,9 @@ function settle(resolve, reject, response) {
|
|
|
2056
2036
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
2057
2037
|
resolve(response);
|
|
2058
2038
|
} else {
|
|
2059
|
-
reject(new AxiosError$
|
|
2039
|
+
reject(new AxiosError$2(
|
|
2060
2040
|
'Request failed with status code ' + response.status,
|
|
2061
|
-
[AxiosError$
|
|
2041
|
+
[AxiosError$2.ERR_BAD_REQUEST, AxiosError$2.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
|
2062
2042
|
response.config,
|
|
2063
2043
|
response.request,
|
|
2064
2044
|
response
|
|
@@ -2334,7 +2314,7 @@ function mergeConfig$1(config1, config2) {
|
|
|
2334
2314
|
|
|
2335
2315
|
function getMergedValue(target, source, prop, caseless) {
|
|
2336
2316
|
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
2337
|
-
return utils$1.merge.call({caseless}, target, source);
|
|
2317
|
+
return utils$1.merge.call({ caseless }, target, source);
|
|
2338
2318
|
} else if (utils$1.isPlainObject(source)) {
|
|
2339
2319
|
return utils$1.merge({}, source);
|
|
2340
2320
|
} else if (utils$1.isArray(source)) {
|
|
@@ -2343,7 +2323,6 @@ function mergeConfig$1(config1, config2) {
|
|
|
2343
2323
|
return source;
|
|
2344
2324
|
}
|
|
2345
2325
|
|
|
2346
|
-
// eslint-disable-next-line consistent-return
|
|
2347
2326
|
function mergeDeepProperties(a, b, prop, caseless) {
|
|
2348
2327
|
if (!utils$1.isUndefined(b)) {
|
|
2349
2328
|
return getMergedValue(a, b, prop, caseless);
|
|
@@ -2409,7 +2388,7 @@ function mergeConfig$1(config1, config2) {
|
|
|
2409
2388
|
headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
|
|
2410
2389
|
};
|
|
2411
2390
|
|
|
2412
|
-
utils$1.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
|
|
2391
|
+
utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
|
|
2413
2392
|
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
2414
2393
|
const configValue = merge(config1[prop], config2[prop], prop);
|
|
2415
2394
|
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
@@ -2558,7 +2537,7 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
2558
2537
|
return;
|
|
2559
2538
|
}
|
|
2560
2539
|
|
|
2561
|
-
reject(new AxiosError$
|
|
2540
|
+
reject(new AxiosError$2('Request aborted', AxiosError$2.ECONNABORTED, config, request));
|
|
2562
2541
|
|
|
2563
2542
|
// Clean up request
|
|
2564
2543
|
request = null;
|
|
@@ -2570,7 +2549,7 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
2570
2549
|
// (message may be empty; when present, surface it)
|
|
2571
2550
|
// See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
|
|
2572
2551
|
const msg = event && event.message ? event.message : 'Network Error';
|
|
2573
|
-
const err = new AxiosError$
|
|
2552
|
+
const err = new AxiosError$2(msg, AxiosError$2.ERR_NETWORK, config, request);
|
|
2574
2553
|
// attach the underlying event for consumers who want details
|
|
2575
2554
|
err.event = event || null;
|
|
2576
2555
|
reject(err);
|
|
@@ -2584,9 +2563,9 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
2584
2563
|
if (_config.timeoutErrorMessage) {
|
|
2585
2564
|
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
2586
2565
|
}
|
|
2587
|
-
reject(new AxiosError$
|
|
2566
|
+
reject(new AxiosError$2(
|
|
2588
2567
|
timeoutErrorMessage,
|
|
2589
|
-
transitional.clarifyTimeoutError ? AxiosError$
|
|
2568
|
+
transitional.clarifyTimeoutError ? AxiosError$2.ETIMEDOUT : AxiosError$2.ECONNABORTED,
|
|
2590
2569
|
config,
|
|
2591
2570
|
request));
|
|
2592
2571
|
|
|
@@ -2636,7 +2615,7 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
2636
2615
|
if (!request) {
|
|
2637
2616
|
return;
|
|
2638
2617
|
}
|
|
2639
|
-
reject(!cancel || cancel.type ? new CanceledError$
|
|
2618
|
+
reject(!cancel || cancel.type ? new CanceledError$2(null, config, request) : cancel);
|
|
2640
2619
|
request.abort();
|
|
2641
2620
|
request = null;
|
|
2642
2621
|
};
|
|
@@ -2650,7 +2629,7 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
2650
2629
|
const protocol = parseProtocol(_config.url);
|
|
2651
2630
|
|
|
2652
2631
|
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
2653
|
-
reject(new AxiosError$
|
|
2632
|
+
reject(new AxiosError$2('Unsupported protocol ' + protocol + ':', AxiosError$2.ERR_BAD_REQUEST, config));
|
|
2654
2633
|
return;
|
|
2655
2634
|
}
|
|
2656
2635
|
|
|
@@ -2673,13 +2652,13 @@ const composeSignals = (signals, timeout) => {
|
|
|
2673
2652
|
aborted = true;
|
|
2674
2653
|
unsubscribe();
|
|
2675
2654
|
const err = reason instanceof Error ? reason : this.reason;
|
|
2676
|
-
controller.abort(err instanceof AxiosError$
|
|
2655
|
+
controller.abort(err instanceof AxiosError$2 ? err : new CanceledError$2(err instanceof Error ? err.message : err));
|
|
2677
2656
|
}
|
|
2678
2657
|
};
|
|
2679
2658
|
|
|
2680
2659
|
let timer = timeout && setTimeout(() => {
|
|
2681
2660
|
timer = null;
|
|
2682
|
-
onabort(new AxiosError$
|
|
2661
|
+
onabort(new AxiosError$2(`timeout of ${timeout}ms exceeded`, AxiosError$2.ETIMEDOUT));
|
|
2683
2662
|
}, timeout);
|
|
2684
2663
|
|
|
2685
2664
|
const unsubscribe = () => {
|
|
@@ -2865,7 +2844,7 @@ const factory = (env) => {
|
|
|
2865
2844
|
return method.call(res);
|
|
2866
2845
|
}
|
|
2867
2846
|
|
|
2868
|
-
throw new AxiosError$
|
|
2847
|
+
throw new AxiosError$2(`Response type '${type}' is not supported`, AxiosError$2.ERR_NOT_SUPPORT, config);
|
|
2869
2848
|
});
|
|
2870
2849
|
});
|
|
2871
2850
|
})());
|
|
@@ -3031,14 +3010,14 @@ const factory = (env) => {
|
|
|
3031
3010
|
|
|
3032
3011
|
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
|
3033
3012
|
throw Object.assign(
|
|
3034
|
-
new AxiosError$
|
|
3013
|
+
new AxiosError$2('Network Error', AxiosError$2.ERR_NETWORK, config, request),
|
|
3035
3014
|
{
|
|
3036
3015
|
cause: err.cause || err
|
|
3037
3016
|
}
|
|
3038
3017
|
)
|
|
3039
3018
|
}
|
|
3040
3019
|
|
|
3041
|
-
throw AxiosError$
|
|
3020
|
+
throw AxiosError$2.from(err, err && err.code, config, request);
|
|
3042
3021
|
}
|
|
3043
3022
|
}
|
|
3044
3023
|
};
|
|
@@ -3143,7 +3122,7 @@ function getAdapter$1(adapters, config) {
|
|
|
3143
3122
|
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
3144
3123
|
|
|
3145
3124
|
if (adapter === undefined) {
|
|
3146
|
-
throw new AxiosError$
|
|
3125
|
+
throw new AxiosError$2(`Unknown adapter '${id}'`);
|
|
3147
3126
|
}
|
|
3148
3127
|
}
|
|
3149
3128
|
|
|
@@ -3164,7 +3143,7 @@ function getAdapter$1(adapters, config) {
|
|
|
3164
3143
|
(reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
|
|
3165
3144
|
'as no adapter specified';
|
|
3166
3145
|
|
|
3167
|
-
throw new AxiosError$
|
|
3146
|
+
throw new AxiosError$2(
|
|
3168
3147
|
`There is no suitable adapter to dispatch the request ` + s,
|
|
3169
3148
|
'ERR_NOT_SUPPORT'
|
|
3170
3149
|
);
|
|
@@ -3203,7 +3182,7 @@ function throwIfCancellationRequested(config) {
|
|
|
3203
3182
|
}
|
|
3204
3183
|
|
|
3205
3184
|
if (config.signal && config.signal.aborted) {
|
|
3206
|
-
throw new CanceledError$
|
|
3185
|
+
throw new CanceledError$2(null, config);
|
|
3207
3186
|
}
|
|
3208
3187
|
}
|
|
3209
3188
|
|
|
@@ -3263,7 +3242,7 @@ function dispatchRequest(config) {
|
|
|
3263
3242
|
});
|
|
3264
3243
|
}
|
|
3265
3244
|
|
|
3266
|
-
const VERSION$1 = "1.13.
|
|
3245
|
+
const VERSION$1 = "1.13.3";
|
|
3267
3246
|
|
|
3268
3247
|
const validators$1 = {};
|
|
3269
3248
|
|
|
@@ -3293,9 +3272,9 @@ validators$1.transitional = function transitional(validator, version, message) {
|
|
|
3293
3272
|
// eslint-disable-next-line func-names
|
|
3294
3273
|
return (value, opt, opts) => {
|
|
3295
3274
|
if (validator === false) {
|
|
3296
|
-
throw new AxiosError$
|
|
3275
|
+
throw new AxiosError$2(
|
|
3297
3276
|
formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
|
|
3298
|
-
AxiosError$
|
|
3277
|
+
AxiosError$2.ERR_DEPRECATED
|
|
3299
3278
|
);
|
|
3300
3279
|
}
|
|
3301
3280
|
|
|
@@ -3334,7 +3313,7 @@ validators$1.spelling = function spelling(correctSpelling) {
|
|
|
3334
3313
|
|
|
3335
3314
|
function assertOptions(options, schema, allowUnknown) {
|
|
3336
3315
|
if (typeof options !== 'object') {
|
|
3337
|
-
throw new AxiosError$
|
|
3316
|
+
throw new AxiosError$2('options must be an object', AxiosError$2.ERR_BAD_OPTION_VALUE);
|
|
3338
3317
|
}
|
|
3339
3318
|
const keys = Object.keys(options);
|
|
3340
3319
|
let i = keys.length;
|
|
@@ -3345,12 +3324,12 @@ function assertOptions(options, schema, allowUnknown) {
|
|
|
3345
3324
|
const value = options[opt];
|
|
3346
3325
|
const result = value === undefined || validator(value, opt, options);
|
|
3347
3326
|
if (result !== true) {
|
|
3348
|
-
throw new AxiosError$
|
|
3327
|
+
throw new AxiosError$2('option ' + opt + ' must be ' + result, AxiosError$2.ERR_BAD_OPTION_VALUE);
|
|
3349
3328
|
}
|
|
3350
3329
|
continue;
|
|
3351
3330
|
}
|
|
3352
3331
|
if (allowUnknown !== true) {
|
|
3353
|
-
throw new AxiosError$
|
|
3332
|
+
throw new AxiosError$2('Unknown option ' + opt, AxiosError$2.ERR_BAD_OPTION);
|
|
3354
3333
|
}
|
|
3355
3334
|
}
|
|
3356
3335
|
}
|
|
@@ -3508,8 +3487,13 @@ class Axios$1 {
|
|
|
3508
3487
|
|
|
3509
3488
|
promise = Promise.resolve(config);
|
|
3510
3489
|
|
|
3490
|
+
let prevResult = config;
|
|
3511
3491
|
while (i < len) {
|
|
3512
|
-
promise = promise
|
|
3492
|
+
promise = promise
|
|
3493
|
+
.then(chain[i++])
|
|
3494
|
+
.then(result => { prevResult = result !== undefined ? result : prevResult; })
|
|
3495
|
+
.catch(chain[i++])
|
|
3496
|
+
.then(() => prevResult);
|
|
3513
3497
|
}
|
|
3514
3498
|
|
|
3515
3499
|
return promise;
|
|
@@ -3540,7 +3524,7 @@ class Axios$1 {
|
|
|
3540
3524
|
len = responseInterceptorChain.length;
|
|
3541
3525
|
|
|
3542
3526
|
while (i < len) {
|
|
3543
|
-
promise = promise.then(responseInterceptorChain[i++]
|
|
3527
|
+
promise = promise.then(responseInterceptorChain[i++]).catch(responseInterceptorChain[i++]);
|
|
3544
3528
|
}
|
|
3545
3529
|
|
|
3546
3530
|
return promise;
|
|
@@ -3643,7 +3627,7 @@ class CancelToken$1 {
|
|
|
3643
3627
|
return;
|
|
3644
3628
|
}
|
|
3645
3629
|
|
|
3646
|
-
token.reason = new CanceledError$
|
|
3630
|
+
token.reason = new CanceledError$2(message, config, request);
|
|
3647
3631
|
resolvePromise(token.reason);
|
|
3648
3632
|
});
|
|
3649
3633
|
}
|
|
@@ -3727,7 +3711,7 @@ const CancelToken$2 = CancelToken$1;
|
|
|
3727
3711
|
*
|
|
3728
3712
|
* ```js
|
|
3729
3713
|
* function f(x, y, z) {}
|
|
3730
|
-
*
|
|
3714
|
+
* const args = [1, 2, 3];
|
|
3731
3715
|
* f.apply(null, args);
|
|
3732
3716
|
* ```
|
|
3733
3717
|
*
|
|
@@ -3868,14 +3852,14 @@ const axios = createInstance(defaults$1);
|
|
|
3868
3852
|
axios.Axios = Axios$2;
|
|
3869
3853
|
|
|
3870
3854
|
// Expose Cancel & CancelToken
|
|
3871
|
-
axios.CanceledError = CanceledError$
|
|
3855
|
+
axios.CanceledError = CanceledError$2;
|
|
3872
3856
|
axios.CancelToken = CancelToken$2;
|
|
3873
3857
|
axios.isCancel = isCancel$1;
|
|
3874
3858
|
axios.VERSION = VERSION$1;
|
|
3875
3859
|
axios.toFormData = toFormData$1;
|
|
3876
3860
|
|
|
3877
3861
|
// Expose AxiosError class
|
|
3878
|
-
axios.AxiosError = AxiosError$
|
|
3862
|
+
axios.AxiosError = AxiosError$2;
|
|
3879
3863
|
|
|
3880
3864
|
// alias for CanceledError for backward compatibility
|
|
3881
3865
|
axios.Cancel = axios.CanceledError;
|