axios 1.13.1 → 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 +85 -0
- package/MIGRATION_GUIDE.md +876 -2
- package/README.md +136 -81
- 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 +210 -218
- 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 +35 -28
- 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/node/axios.cjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/*! Axios v1.13.
|
|
1
|
+
/*! Axios v1.13.3 Copyright (c) 2026 Matt Zabriskie and contributors */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
const FormData$1 = require('form-data');
|
|
5
5
|
const crypto = require('crypto');
|
|
6
6
|
const url = require('url');
|
|
7
|
-
const http2 = require('http2');
|
|
8
7
|
const proxyFromEnv = require('proxy-from-env');
|
|
9
8
|
const http = require('http');
|
|
10
9
|
const https = require('https');
|
|
10
|
+
const http2 = require('http2');
|
|
11
11
|
const util = require('util');
|
|
12
12
|
const followRedirects = require('follow-redirects');
|
|
13
13
|
const zlib = require('zlib');
|
|
@@ -22,6 +22,7 @@ const url__default = /*#__PURE__*/_interopDefaultLegacy(url);
|
|
|
22
22
|
const proxyFromEnv__default = /*#__PURE__*/_interopDefaultLegacy(proxyFromEnv);
|
|
23
23
|
const http__default = /*#__PURE__*/_interopDefaultLegacy(http);
|
|
24
24
|
const https__default = /*#__PURE__*/_interopDefaultLegacy(https);
|
|
25
|
+
const http2__default = /*#__PURE__*/_interopDefaultLegacy(http2);
|
|
25
26
|
const util__default = /*#__PURE__*/_interopDefaultLegacy(util);
|
|
26
27
|
const followRedirects__default = /*#__PURE__*/_interopDefaultLegacy(followRedirects);
|
|
27
28
|
const zlib__default = /*#__PURE__*/_interopDefaultLegacy(zlib);
|
|
@@ -290,10 +291,11 @@ const trim = (str) => str.trim ?
|
|
|
290
291
|
* If 'obj' is an Object callback will be called passing
|
|
291
292
|
* the value, key, and complete object for each property.
|
|
292
293
|
*
|
|
293
|
-
* @param {Object|Array} obj The object to iterate
|
|
294
|
+
* @param {Object|Array<unknown>} obj The object to iterate
|
|
294
295
|
* @param {Function} fn The callback to invoke for each item
|
|
295
296
|
*
|
|
296
|
-
* @param {
|
|
297
|
+
* @param {Object} [options]
|
|
298
|
+
* @param {Boolean} [options.allOwnKeys = false]
|
|
297
299
|
* @returns {any}
|
|
298
300
|
*/
|
|
299
301
|
function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
@@ -370,7 +372,7 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
|
|
|
370
372
|
* Example:
|
|
371
373
|
*
|
|
372
374
|
* ```js
|
|
373
|
-
*
|
|
375
|
+
* const result = merge({foo: 123}, {foo: 456});
|
|
374
376
|
* console.log(result.foo); // outputs 456
|
|
375
377
|
* ```
|
|
376
378
|
*
|
|
@@ -407,15 +409,26 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
407
409
|
* @param {Object} b The object to copy properties from
|
|
408
410
|
* @param {Object} thisArg The object to bind function to
|
|
409
411
|
*
|
|
410
|
-
* @param {
|
|
412
|
+
* @param {Object} [options]
|
|
413
|
+
* @param {Boolean} [options.allOwnKeys]
|
|
411
414
|
* @returns {Object} The resulting value of object a
|
|
412
415
|
*/
|
|
413
416
|
const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
|
|
414
417
|
forEach(b, (val, key) => {
|
|
415
418
|
if (thisArg && isFunction$1(val)) {
|
|
416
|
-
a
|
|
419
|
+
Object.defineProperty(a, key, {
|
|
420
|
+
value: bind(val, thisArg),
|
|
421
|
+
writable: true,
|
|
422
|
+
enumerable: true,
|
|
423
|
+
configurable: true
|
|
424
|
+
});
|
|
417
425
|
} else {
|
|
418
|
-
a
|
|
426
|
+
Object.defineProperty(a, key, {
|
|
427
|
+
value: val,
|
|
428
|
+
writable: true,
|
|
429
|
+
enumerable: true,
|
|
430
|
+
configurable: true
|
|
431
|
+
});
|
|
419
432
|
}
|
|
420
433
|
}, {allOwnKeys});
|
|
421
434
|
return a;
|
|
@@ -446,7 +459,12 @@ const stripBOM = (content) => {
|
|
|
446
459
|
*/
|
|
447
460
|
const inherits = (constructor, superConstructor, props, descriptors) => {
|
|
448
461
|
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
|
449
|
-
constructor.prototype
|
|
462
|
+
Object.defineProperty(constructor.prototype, 'constructor', {
|
|
463
|
+
value: constructor,
|
|
464
|
+
writable: true,
|
|
465
|
+
enumerable: false,
|
|
466
|
+
configurable: true
|
|
467
|
+
});
|
|
450
468
|
Object.defineProperty(constructor, 'super', {
|
|
451
469
|
value: superConstructor.prototype
|
|
452
470
|
});
|
|
@@ -819,110 +837,75 @@ const utils$1 = {
|
|
|
819
837
|
isIterable
|
|
820
838
|
};
|
|
821
839
|
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
840
|
+
class AxiosError extends Error {
|
|
841
|
+
static from(error, code, config, request, response, customProps) {
|
|
842
|
+
const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
|
|
843
|
+
axiosError.cause = error;
|
|
844
|
+
axiosError.name = error.name;
|
|
845
|
+
customProps && Object.assign(axiosError, customProps);
|
|
846
|
+
return axiosError;
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
/**
|
|
850
|
+
* Create an Error with the specified message, config, error code, request and response.
|
|
851
|
+
*
|
|
852
|
+
* @param {string} message The error message.
|
|
853
|
+
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
854
|
+
* @param {Object} [config] The config.
|
|
855
|
+
* @param {Object} [request] The request.
|
|
856
|
+
* @param {Object} [response] The response.
|
|
857
|
+
*
|
|
858
|
+
* @returns {Error} The created error.
|
|
859
|
+
*/
|
|
860
|
+
constructor(message, code, config, request, response) {
|
|
861
|
+
super(message);
|
|
862
|
+
this.name = 'AxiosError';
|
|
863
|
+
this.isAxiosError = true;
|
|
864
|
+
code && (this.code = code);
|
|
865
|
+
config && (this.config = config);
|
|
866
|
+
request && (this.request = request);
|
|
867
|
+
if (response) {
|
|
868
|
+
this.response = response;
|
|
869
|
+
this.status = response.status;
|
|
870
|
+
}
|
|
871
|
+
}
|
|
841
872
|
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
873
|
+
toJSON() {
|
|
874
|
+
return {
|
|
875
|
+
// Standard
|
|
876
|
+
message: this.message,
|
|
877
|
+
name: this.name,
|
|
878
|
+
// Microsoft
|
|
879
|
+
description: this.description,
|
|
880
|
+
number: this.number,
|
|
881
|
+
// Mozilla
|
|
882
|
+
fileName: this.fileName,
|
|
883
|
+
lineNumber: this.lineNumber,
|
|
884
|
+
columnNumber: this.columnNumber,
|
|
885
|
+
stack: this.stack,
|
|
886
|
+
// Axios
|
|
887
|
+
config: utils$1.toJSONObject(this.config),
|
|
888
|
+
code: this.code,
|
|
889
|
+
status: this.status,
|
|
890
|
+
};
|
|
891
|
+
}
|
|
851
892
|
}
|
|
852
893
|
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
config: utils$1.toJSONObject(this.config),
|
|
869
|
-
code: this.code,
|
|
870
|
-
status: this.status
|
|
871
|
-
};
|
|
872
|
-
}
|
|
873
|
-
});
|
|
874
|
-
|
|
875
|
-
const prototype$1 = AxiosError.prototype;
|
|
876
|
-
const descriptors = {};
|
|
877
|
-
|
|
878
|
-
[
|
|
879
|
-
'ERR_BAD_OPTION_VALUE',
|
|
880
|
-
'ERR_BAD_OPTION',
|
|
881
|
-
'ECONNABORTED',
|
|
882
|
-
'ETIMEDOUT',
|
|
883
|
-
'ERR_NETWORK',
|
|
884
|
-
'ERR_FR_TOO_MANY_REDIRECTS',
|
|
885
|
-
'ERR_DEPRECATED',
|
|
886
|
-
'ERR_BAD_RESPONSE',
|
|
887
|
-
'ERR_BAD_REQUEST',
|
|
888
|
-
'ERR_CANCELED',
|
|
889
|
-
'ERR_NOT_SUPPORT',
|
|
890
|
-
'ERR_INVALID_URL'
|
|
891
|
-
// eslint-disable-next-line func-names
|
|
892
|
-
].forEach(code => {
|
|
893
|
-
descriptors[code] = {value: code};
|
|
894
|
-
});
|
|
895
|
-
|
|
896
|
-
Object.defineProperties(AxiosError, descriptors);
|
|
897
|
-
Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
|
|
898
|
-
|
|
899
|
-
// eslint-disable-next-line func-names
|
|
900
|
-
AxiosError.from = (error, code, config, request, response, customProps) => {
|
|
901
|
-
const axiosError = Object.create(prototype$1);
|
|
902
|
-
|
|
903
|
-
utils$1.toFlatObject(error, axiosError, function filter(obj) {
|
|
904
|
-
return obj !== Error.prototype;
|
|
905
|
-
}, prop => {
|
|
906
|
-
return prop !== 'isAxiosError';
|
|
907
|
-
});
|
|
908
|
-
|
|
909
|
-
const msg = error && error.message ? error.message : 'Error';
|
|
910
|
-
|
|
911
|
-
// Prefer explicit code; otherwise copy the low-level error's code (e.g. ECONNREFUSED)
|
|
912
|
-
const errCode = code == null && error ? error.code : code;
|
|
913
|
-
AxiosError.call(axiosError, msg, errCode, config, request, response);
|
|
914
|
-
|
|
915
|
-
// Chain the original error on the standard field; non-enumerable to avoid JSON noise
|
|
916
|
-
if (error && axiosError.cause == null) {
|
|
917
|
-
Object.defineProperty(axiosError, 'cause', { value: error, configurable: true });
|
|
918
|
-
}
|
|
919
|
-
|
|
920
|
-
axiosError.name = (error && error.name) || 'Error';
|
|
921
|
-
|
|
922
|
-
customProps && Object.assign(axiosError, customProps);
|
|
923
|
-
|
|
924
|
-
return axiosError;
|
|
925
|
-
};
|
|
894
|
+
// This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
|
|
895
|
+
AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
|
|
896
|
+
AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
|
|
897
|
+
AxiosError.ECONNABORTED = 'ECONNABORTED';
|
|
898
|
+
AxiosError.ETIMEDOUT = 'ETIMEDOUT';
|
|
899
|
+
AxiosError.ERR_NETWORK = 'ERR_NETWORK';
|
|
900
|
+
AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
|
|
901
|
+
AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
|
|
902
|
+
AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
|
|
903
|
+
AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
|
|
904
|
+
AxiosError.ERR_CANCELED = 'ERR_CANCELED';
|
|
905
|
+
AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
|
|
906
|
+
AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
|
|
907
|
+
|
|
908
|
+
const AxiosError$1 = AxiosError;
|
|
926
909
|
|
|
927
910
|
/**
|
|
928
911
|
* Determines if the given thing is a array or js object.
|
|
@@ -1044,7 +1027,7 @@ function toFormData(obj, formData, options) {
|
|
|
1044
1027
|
}
|
|
1045
1028
|
|
|
1046
1029
|
if (!useBlob && utils$1.isBlob(value)) {
|
|
1047
|
-
throw new AxiosError('Blob is not supported. Use a Buffer instead.');
|
|
1030
|
+
throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
|
|
1048
1031
|
}
|
|
1049
1032
|
|
|
1050
1033
|
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
|
|
@@ -1218,29 +1201,26 @@ function encode(val) {
|
|
|
1218
1201
|
* @returns {string} The formatted url
|
|
1219
1202
|
*/
|
|
1220
1203
|
function buildURL(url, params, options) {
|
|
1221
|
-
/*eslint no-param-reassign:0*/
|
|
1222
1204
|
if (!params) {
|
|
1223
1205
|
return url;
|
|
1224
1206
|
}
|
|
1225
|
-
|
|
1207
|
+
|
|
1226
1208
|
const _encode = options && options.encode || encode;
|
|
1227
1209
|
|
|
1228
|
-
|
|
1229
|
-
options
|
|
1230
|
-
|
|
1231
|
-
};
|
|
1232
|
-
}
|
|
1210
|
+
const _options = utils$1.isFunction(options) ? {
|
|
1211
|
+
serialize: options
|
|
1212
|
+
} : options;
|
|
1233
1213
|
|
|
1234
|
-
const serializeFn =
|
|
1214
|
+
const serializeFn = _options && _options.serialize;
|
|
1235
1215
|
|
|
1236
1216
|
let serializedParams;
|
|
1237
1217
|
|
|
1238
1218
|
if (serializeFn) {
|
|
1239
|
-
serializedParams = serializeFn(params,
|
|
1219
|
+
serializedParams = serializeFn(params, _options);
|
|
1240
1220
|
} else {
|
|
1241
1221
|
serializedParams = utils$1.isURLSearchParams(params) ?
|
|
1242
1222
|
params.toString() :
|
|
1243
|
-
new AxiosURLSearchParams(params,
|
|
1223
|
+
new AxiosURLSearchParams(params, _options).toString(_encode);
|
|
1244
1224
|
}
|
|
1245
1225
|
|
|
1246
1226
|
if (serializedParams) {
|
|
@@ -1265,6 +1245,7 @@ class InterceptorManager {
|
|
|
1265
1245
|
*
|
|
1266
1246
|
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
1267
1247
|
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
1248
|
+
* @param {Object} options The options for the interceptor, synchronous and runWhen
|
|
1268
1249
|
*
|
|
1269
1250
|
* @return {Number} An ID used to remove interceptor later
|
|
1270
1251
|
*/
|
|
@@ -1635,7 +1616,7 @@ const defaults = {
|
|
|
1635
1616
|
} catch (e) {
|
|
1636
1617
|
if (strictJSONParsing) {
|
|
1637
1618
|
if (e.name === 'SyntaxError') {
|
|
1638
|
-
throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
|
|
1619
|
+
throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
|
|
1639
1620
|
}
|
|
1640
1621
|
throw e;
|
|
1641
1622
|
}
|
|
@@ -2069,24 +2050,24 @@ function isCancel(value) {
|
|
|
2069
2050
|
return !!(value && value.__CANCEL__);
|
|
2070
2051
|
}
|
|
2071
2052
|
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2053
|
+
class CanceledError extends AxiosError$1 {
|
|
2054
|
+
/**
|
|
2055
|
+
* A `CanceledError` is an object that is thrown when an operation is canceled.
|
|
2056
|
+
*
|
|
2057
|
+
* @param {string=} message The message.
|
|
2058
|
+
* @param {Object=} config The config.
|
|
2059
|
+
* @param {Object=} request The request.
|
|
2060
|
+
*
|
|
2061
|
+
* @returns {CanceledError} The created error.
|
|
2062
|
+
*/
|
|
2063
|
+
constructor(message, config, request) {
|
|
2064
|
+
super(message == null ? 'canceled' : message, AxiosError$1.ERR_CANCELED, config, request);
|
|
2065
|
+
this.name = 'CanceledError';
|
|
2066
|
+
this.__CANCEL__ = true;
|
|
2067
|
+
}
|
|
2085
2068
|
}
|
|
2086
2069
|
|
|
2087
|
-
|
|
2088
|
-
__CANCEL__: true
|
|
2089
|
-
});
|
|
2070
|
+
const CanceledError$1 = CanceledError;
|
|
2090
2071
|
|
|
2091
2072
|
/**
|
|
2092
2073
|
* Resolve or reject a Promise based on response status.
|
|
@@ -2102,9 +2083,9 @@ function settle(resolve, reject, response) {
|
|
|
2102
2083
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
2103
2084
|
resolve(response);
|
|
2104
2085
|
} else {
|
|
2105
|
-
reject(new AxiosError(
|
|
2086
|
+
reject(new AxiosError$1(
|
|
2106
2087
|
'Request failed with status code ' + response.status,
|
|
2107
|
-
[AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
|
2088
|
+
[AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
|
2108
2089
|
response.config,
|
|
2109
2090
|
response.request,
|
|
2110
2091
|
response
|
|
@@ -2158,7 +2139,7 @@ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
|
2158
2139
|
return requestedURL;
|
|
2159
2140
|
}
|
|
2160
2141
|
|
|
2161
|
-
const VERSION = "1.13.
|
|
2142
|
+
const VERSION = "1.13.3";
|
|
2162
2143
|
|
|
2163
2144
|
function parseProtocol(url) {
|
|
2164
2145
|
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
@@ -2191,7 +2172,7 @@ function fromDataURI(uri, asBlob, options) {
|
|
|
2191
2172
|
const match = DATA_URL_PATTERN.exec(uri);
|
|
2192
2173
|
|
|
2193
2174
|
if (!match) {
|
|
2194
|
-
throw new AxiosError('Invalid URL', AxiosError.ERR_INVALID_URL);
|
|
2175
|
+
throw new AxiosError$1('Invalid URL', AxiosError$1.ERR_INVALID_URL);
|
|
2195
2176
|
}
|
|
2196
2177
|
|
|
2197
2178
|
const mime = match[1];
|
|
@@ -2201,7 +2182,7 @@ function fromDataURI(uri, asBlob, options) {
|
|
|
2201
2182
|
|
|
2202
2183
|
if (asBlob) {
|
|
2203
2184
|
if (!_Blob) {
|
|
2204
|
-
throw new AxiosError('Blob is not supported', AxiosError.ERR_NOT_SUPPORT);
|
|
2185
|
+
throw new AxiosError$1('Blob is not supported', AxiosError$1.ERR_NOT_SUPPORT);
|
|
2205
2186
|
}
|
|
2206
2187
|
|
|
2207
2188
|
return new _Blob([buffer], {type: mime});
|
|
@@ -2210,7 +2191,7 @@ function fromDataURI(uri, asBlob, options) {
|
|
|
2210
2191
|
return buffer;
|
|
2211
2192
|
}
|
|
2212
2193
|
|
|
2213
|
-
throw new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_NOT_SUPPORT);
|
|
2194
|
+
throw new AxiosError$1('Unsupported protocol ' + protocol, AxiosError$1.ERR_NOT_SUPPORT);
|
|
2214
2195
|
}
|
|
2215
2196
|
|
|
2216
2197
|
const kInternals = Symbol('internals');
|
|
@@ -2735,13 +2716,6 @@ const brotliOptions = {
|
|
|
2735
2716
|
finishFlush: zlib__default["default"].constants.BROTLI_OPERATION_FLUSH
|
|
2736
2717
|
};
|
|
2737
2718
|
|
|
2738
|
-
const {
|
|
2739
|
-
HTTP2_HEADER_SCHEME,
|
|
2740
|
-
HTTP2_HEADER_METHOD,
|
|
2741
|
-
HTTP2_HEADER_PATH,
|
|
2742
|
-
HTTP2_HEADER_STATUS
|
|
2743
|
-
} = http2.constants;
|
|
2744
|
-
|
|
2745
2719
|
const isBrotliSupported = utils$1.isFunction(zlib__default["default"].createBrotliDecompress);
|
|
2746
2720
|
|
|
2747
2721
|
const {http: httpFollow, https: httpsFollow} = followRedirects__default["default"];
|
|
@@ -2771,9 +2745,9 @@ class Http2Sessions {
|
|
|
2771
2745
|
sessionTimeout: 1000
|
|
2772
2746
|
}, options);
|
|
2773
2747
|
|
|
2774
|
-
let authoritySessions;
|
|
2748
|
+
let authoritySessions = this.sessions[authority];
|
|
2775
2749
|
|
|
2776
|
-
if (
|
|
2750
|
+
if (authoritySessions) {
|
|
2777
2751
|
let len = authoritySessions.length;
|
|
2778
2752
|
|
|
2779
2753
|
for (let i = 0; i < len; i++) {
|
|
@@ -2784,7 +2758,7 @@ class Http2Sessions {
|
|
|
2784
2758
|
}
|
|
2785
2759
|
}
|
|
2786
2760
|
|
|
2787
|
-
const session =
|
|
2761
|
+
const session = http2__default["default"].connect(authority, options);
|
|
2788
2762
|
|
|
2789
2763
|
let removed;
|
|
2790
2764
|
|
|
@@ -2799,11 +2773,12 @@ class Http2Sessions {
|
|
|
2799
2773
|
|
|
2800
2774
|
while (i--) {
|
|
2801
2775
|
if (entries[i][0] === session) {
|
|
2802
|
-
entries.splice(i, 1);
|
|
2803
2776
|
if (len === 1) {
|
|
2804
2777
|
delete this.sessions[authority];
|
|
2805
|
-
|
|
2778
|
+
} else {
|
|
2779
|
+
entries.splice(i, 1);
|
|
2806
2780
|
}
|
|
2781
|
+
return;
|
|
2807
2782
|
}
|
|
2808
2783
|
}
|
|
2809
2784
|
};
|
|
@@ -2842,12 +2817,12 @@ class Http2Sessions {
|
|
|
2842
2817
|
|
|
2843
2818
|
session.once('close', removeSession);
|
|
2844
2819
|
|
|
2845
|
-
let
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2820
|
+
let entry = [
|
|
2821
|
+
session,
|
|
2822
|
+
options
|
|
2823
|
+
];
|
|
2849
2824
|
|
|
2850
|
-
|
|
2825
|
+
authoritySessions ? authoritySessions.push(entry) : authoritySessions = this.sessions[authority] = [entry];
|
|
2851
2826
|
|
|
2852
2827
|
return session;
|
|
2853
2828
|
}
|
|
@@ -2898,12 +2873,16 @@ function setProxy(options, configProxy, location) {
|
|
|
2898
2873
|
|
|
2899
2874
|
if (proxy.auth) {
|
|
2900
2875
|
// Support proxy auth object form
|
|
2901
|
-
|
|
2876
|
+
const validProxyAuth = Boolean(proxy.auth.username || proxy.auth.password);
|
|
2877
|
+
|
|
2878
|
+
if (validProxyAuth) {
|
|
2902
2879
|
proxy.auth = (proxy.auth.username || '') + ':' + (proxy.auth.password || '');
|
|
2880
|
+
} else if (typeof proxy.auth === 'object') {
|
|
2881
|
+
throw new AxiosError$1('Invalid proxy authorization', AxiosError$1.ERR_BAD_OPTION, { proxy });
|
|
2903
2882
|
}
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2883
|
+
|
|
2884
|
+
const base64 = Buffer.from(proxy.auth, 'utf8').toString('base64');
|
|
2885
|
+
|
|
2907
2886
|
options.headers['Proxy-Authorization'] = 'Basic ' + base64;
|
|
2908
2887
|
}
|
|
2909
2888
|
|
|
@@ -2969,12 +2948,20 @@ const buildAddressEntry = (address, family) => resolveFamily(utils$1.isObject(ad
|
|
|
2969
2948
|
|
|
2970
2949
|
const http2Transport = {
|
|
2971
2950
|
request(options, cb) {
|
|
2972
|
-
const authority = options.protocol + '//' + options.hostname + ':' + (options.port || 80);
|
|
2951
|
+
const authority = options.protocol + '//' + options.hostname + ':' + (options.port ||(options.protocol === 'https:' ? 443 : 80));
|
|
2952
|
+
|
|
2973
2953
|
|
|
2974
2954
|
const {http2Options, headers} = options;
|
|
2975
2955
|
|
|
2976
2956
|
const session = http2Sessions.getSession(authority, http2Options);
|
|
2977
2957
|
|
|
2958
|
+
const {
|
|
2959
|
+
HTTP2_HEADER_SCHEME,
|
|
2960
|
+
HTTP2_HEADER_METHOD,
|
|
2961
|
+
HTTP2_HEADER_PATH,
|
|
2962
|
+
HTTP2_HEADER_STATUS
|
|
2963
|
+
} = http2__default["default"].constants;
|
|
2964
|
+
|
|
2978
2965
|
const http2Headers = {
|
|
2979
2966
|
[HTTP2_HEADER_SCHEME]: options.protocol.replace(':', ''),
|
|
2980
2967
|
[HTTP2_HEADER_METHOD]: options.method,
|
|
@@ -3049,7 +3036,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
3049
3036
|
|
|
3050
3037
|
function abort(reason) {
|
|
3051
3038
|
try {
|
|
3052
|
-
abortEmitter.emit('abort', !reason || reason.type ? new CanceledError(null, config, req) : reason);
|
|
3039
|
+
abortEmitter.emit('abort', !reason || reason.type ? new CanceledError$1(null, config, req) : reason);
|
|
3053
3040
|
} catch(err) {
|
|
3054
3041
|
console.warn('emit error', err);
|
|
3055
3042
|
}
|
|
@@ -3114,9 +3101,9 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
3114
3101
|
const estimated = estimateDataURLDecodedBytes(dataUrl);
|
|
3115
3102
|
|
|
3116
3103
|
if (estimated > config.maxContentLength) {
|
|
3117
|
-
return reject(new AxiosError(
|
|
3104
|
+
return reject(new AxiosError$1(
|
|
3118
3105
|
'maxContentLength size of ' + config.maxContentLength + ' exceeded',
|
|
3119
|
-
AxiosError.ERR_BAD_RESPONSE,
|
|
3106
|
+
AxiosError$1.ERR_BAD_RESPONSE,
|
|
3120
3107
|
config
|
|
3121
3108
|
));
|
|
3122
3109
|
}
|
|
@@ -3138,7 +3125,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
3138
3125
|
Blob: config.env && config.env.Blob
|
|
3139
3126
|
});
|
|
3140
3127
|
} catch (err) {
|
|
3141
|
-
throw AxiosError.from(err, AxiosError.ERR_BAD_REQUEST, config);
|
|
3128
|
+
throw AxiosError$1.from(err, AxiosError$1.ERR_BAD_REQUEST, config);
|
|
3142
3129
|
}
|
|
3143
3130
|
|
|
3144
3131
|
if (responseType === 'text') {
|
|
@@ -3161,9 +3148,9 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
3161
3148
|
}
|
|
3162
3149
|
|
|
3163
3150
|
if (supportedProtocols.indexOf(protocol) === -1) {
|
|
3164
|
-
return reject(new AxiosError(
|
|
3151
|
+
return reject(new AxiosError$1(
|
|
3165
3152
|
'Unsupported protocol ' + protocol,
|
|
3166
|
-
AxiosError.ERR_BAD_REQUEST,
|
|
3153
|
+
AxiosError$1.ERR_BAD_REQUEST,
|
|
3167
3154
|
config
|
|
3168
3155
|
));
|
|
3169
3156
|
}
|
|
@@ -3213,9 +3200,9 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
3213
3200
|
} else if (utils$1.isString(data)) {
|
|
3214
3201
|
data = Buffer.from(data, 'utf-8');
|
|
3215
3202
|
} else {
|
|
3216
|
-
return reject(new AxiosError(
|
|
3203
|
+
return reject(new AxiosError$1(
|
|
3217
3204
|
'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream',
|
|
3218
|
-
AxiosError.ERR_BAD_REQUEST,
|
|
3205
|
+
AxiosError$1.ERR_BAD_REQUEST,
|
|
3219
3206
|
config
|
|
3220
3207
|
));
|
|
3221
3208
|
}
|
|
@@ -3224,9 +3211,9 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
3224
3211
|
headers.setContentLength(data.length, false);
|
|
3225
3212
|
|
|
3226
3213
|
if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) {
|
|
3227
|
-
return reject(new AxiosError(
|
|
3214
|
+
return reject(new AxiosError$1(
|
|
3228
3215
|
'Request body larger than maxBodyLength limit',
|
|
3229
|
-
AxiosError.ERR_BAD_REQUEST,
|
|
3216
|
+
AxiosError$1.ERR_BAD_REQUEST,
|
|
3230
3217
|
config
|
|
3231
3218
|
));
|
|
3232
3219
|
}
|
|
@@ -3448,8 +3435,8 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
3448
3435
|
// stream.destroy() emit aborted event before calling reject() on Node.js v16
|
|
3449
3436
|
rejected = true;
|
|
3450
3437
|
responseStream.destroy();
|
|
3451
|
-
abort(new AxiosError('maxContentLength size of ' + config.maxContentLength + ' exceeded',
|
|
3452
|
-
AxiosError.ERR_BAD_RESPONSE, config, lastRequest));
|
|
3438
|
+
abort(new AxiosError$1('maxContentLength size of ' + config.maxContentLength + ' exceeded',
|
|
3439
|
+
AxiosError$1.ERR_BAD_RESPONSE, config, lastRequest));
|
|
3453
3440
|
}
|
|
3454
3441
|
});
|
|
3455
3442
|
|
|
@@ -3458,9 +3445,9 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
3458
3445
|
return;
|
|
3459
3446
|
}
|
|
3460
3447
|
|
|
3461
|
-
const err = new AxiosError(
|
|
3448
|
+
const err = new AxiosError$1(
|
|
3462
3449
|
'stream has been aborted',
|
|
3463
|
-
AxiosError.ERR_BAD_RESPONSE,
|
|
3450
|
+
AxiosError$1.ERR_BAD_RESPONSE,
|
|
3464
3451
|
config,
|
|
3465
3452
|
lastRequest
|
|
3466
3453
|
);
|
|
@@ -3470,7 +3457,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
3470
3457
|
|
|
3471
3458
|
responseStream.on('error', function handleStreamError(err) {
|
|
3472
3459
|
if (req.destroyed) return;
|
|
3473
|
-
reject(AxiosError.from(err, null, config, lastRequest));
|
|
3460
|
+
reject(AxiosError$1.from(err, null, config, lastRequest));
|
|
3474
3461
|
});
|
|
3475
3462
|
|
|
3476
3463
|
responseStream.on('end', function handleStreamEnd() {
|
|
@@ -3484,7 +3471,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
3484
3471
|
}
|
|
3485
3472
|
response.data = responseData;
|
|
3486
3473
|
} catch (err) {
|
|
3487
|
-
return reject(AxiosError.from(err, null, config, response.request, response));
|
|
3474
|
+
return reject(AxiosError$1.from(err, null, config, response.request, response));
|
|
3488
3475
|
}
|
|
3489
3476
|
settle(resolve, reject, response);
|
|
3490
3477
|
});
|
|
@@ -3508,9 +3495,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
3508
3495
|
|
|
3509
3496
|
// Handle errors
|
|
3510
3497
|
req.on('error', function handleRequestError(err) {
|
|
3511
|
-
|
|
3512
|
-
// if (req.aborted && err.code !== AxiosError.ERR_FR_TOO_MANY_REDIRECTS) return;
|
|
3513
|
-
reject(AxiosError.from(err, null, config, req));
|
|
3498
|
+
reject(AxiosError$1.from(err, null, config, req));
|
|
3514
3499
|
});
|
|
3515
3500
|
|
|
3516
3501
|
// set tcp keep alive to prevent drop connection by peer
|
|
@@ -3525,9 +3510,9 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
3525
3510
|
const timeout = parseInt(config.timeout, 10);
|
|
3526
3511
|
|
|
3527
3512
|
if (Number.isNaN(timeout)) {
|
|
3528
|
-
abort(new AxiosError(
|
|
3513
|
+
abort(new AxiosError$1(
|
|
3529
3514
|
'error trying to parse `config.timeout` to int',
|
|
3530
|
-
AxiosError.ERR_BAD_OPTION_VALUE,
|
|
3515
|
+
AxiosError$1.ERR_BAD_OPTION_VALUE,
|
|
3531
3516
|
config,
|
|
3532
3517
|
req
|
|
3533
3518
|
));
|
|
@@ -3547,13 +3532,16 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
3547
3532
|
if (config.timeoutErrorMessage) {
|
|
3548
3533
|
timeoutErrorMessage = config.timeoutErrorMessage;
|
|
3549
3534
|
}
|
|
3550
|
-
abort(new AxiosError(
|
|
3535
|
+
abort(new AxiosError$1(
|
|
3551
3536
|
timeoutErrorMessage,
|
|
3552
|
-
transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
|
|
3537
|
+
transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
|
|
3553
3538
|
config,
|
|
3554
3539
|
req
|
|
3555
3540
|
));
|
|
3556
3541
|
});
|
|
3542
|
+
} else {
|
|
3543
|
+
// explicitly reset the socket timeout value for a possible `keep-alive` request
|
|
3544
|
+
req.setTimeout(0);
|
|
3557
3545
|
}
|
|
3558
3546
|
|
|
3559
3547
|
|
|
@@ -3573,7 +3561,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
3573
3561
|
|
|
3574
3562
|
data.on('close', () => {
|
|
3575
3563
|
if (!ended && !errored) {
|
|
3576
|
-
abort(new CanceledError('Request stream has been aborted', config, req));
|
|
3564
|
+
abort(new CanceledError$1('Request stream has been aborted', config, req));
|
|
3577
3565
|
}
|
|
3578
3566
|
});
|
|
3579
3567
|
|
|
@@ -3666,7 +3654,7 @@ function mergeConfig(config1, config2) {
|
|
|
3666
3654
|
|
|
3667
3655
|
function getMergedValue(target, source, prop, caseless) {
|
|
3668
3656
|
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
3669
|
-
return utils$1.merge.call({caseless}, target, source);
|
|
3657
|
+
return utils$1.merge.call({ caseless }, target, source);
|
|
3670
3658
|
} else if (utils$1.isPlainObject(source)) {
|
|
3671
3659
|
return utils$1.merge({}, source);
|
|
3672
3660
|
} else if (utils$1.isArray(source)) {
|
|
@@ -3675,7 +3663,6 @@ function mergeConfig(config1, config2) {
|
|
|
3675
3663
|
return source;
|
|
3676
3664
|
}
|
|
3677
3665
|
|
|
3678
|
-
// eslint-disable-next-line consistent-return
|
|
3679
3666
|
function mergeDeepProperties(a, b, prop, caseless) {
|
|
3680
3667
|
if (!utils$1.isUndefined(b)) {
|
|
3681
3668
|
return getMergedValue(a, b, prop, caseless);
|
|
@@ -3741,7 +3728,7 @@ function mergeConfig(config1, config2) {
|
|
|
3741
3728
|
headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
|
|
3742
3729
|
};
|
|
3743
3730
|
|
|
3744
|
-
utils$1.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
|
|
3731
|
+
utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
|
|
3745
3732
|
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
3746
3733
|
const configValue = merge(config1[prop], config2[prop], prop);
|
|
3747
3734
|
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
@@ -3890,7 +3877,7 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
3890
3877
|
return;
|
|
3891
3878
|
}
|
|
3892
3879
|
|
|
3893
|
-
reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
|
|
3880
|
+
reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
|
|
3894
3881
|
|
|
3895
3882
|
// Clean up request
|
|
3896
3883
|
request = null;
|
|
@@ -3902,7 +3889,7 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
3902
3889
|
// (message may be empty; when present, surface it)
|
|
3903
3890
|
// See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
|
|
3904
3891
|
const msg = event && event.message ? event.message : 'Network Error';
|
|
3905
|
-
const err = new AxiosError(msg, AxiosError.ERR_NETWORK, config, request);
|
|
3892
|
+
const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
|
|
3906
3893
|
// attach the underlying event for consumers who want details
|
|
3907
3894
|
err.event = event || null;
|
|
3908
3895
|
reject(err);
|
|
@@ -3916,9 +3903,9 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
3916
3903
|
if (_config.timeoutErrorMessage) {
|
|
3917
3904
|
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
3918
3905
|
}
|
|
3919
|
-
reject(new AxiosError(
|
|
3906
|
+
reject(new AxiosError$1(
|
|
3920
3907
|
timeoutErrorMessage,
|
|
3921
|
-
transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
|
|
3908
|
+
transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
|
|
3922
3909
|
config,
|
|
3923
3910
|
request));
|
|
3924
3911
|
|
|
@@ -3968,7 +3955,7 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
3968
3955
|
if (!request) {
|
|
3969
3956
|
return;
|
|
3970
3957
|
}
|
|
3971
|
-
reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
|
|
3958
|
+
reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
|
|
3972
3959
|
request.abort();
|
|
3973
3960
|
request = null;
|
|
3974
3961
|
};
|
|
@@ -3982,7 +3969,7 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
3982
3969
|
const protocol = parseProtocol(_config.url);
|
|
3983
3970
|
|
|
3984
3971
|
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
3985
|
-
reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
|
|
3972
|
+
reject(new AxiosError$1('Unsupported protocol ' + protocol + ':', AxiosError$1.ERR_BAD_REQUEST, config));
|
|
3986
3973
|
return;
|
|
3987
3974
|
}
|
|
3988
3975
|
|
|
@@ -4005,13 +3992,13 @@ const composeSignals = (signals, timeout) => {
|
|
|
4005
3992
|
aborted = true;
|
|
4006
3993
|
unsubscribe();
|
|
4007
3994
|
const err = reason instanceof Error ? reason : this.reason;
|
|
4008
|
-
controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
|
|
3995
|
+
controller.abort(err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err));
|
|
4009
3996
|
}
|
|
4010
3997
|
};
|
|
4011
3998
|
|
|
4012
3999
|
let timer = timeout && setTimeout(() => {
|
|
4013
4000
|
timer = null;
|
|
4014
|
-
onabort(new AxiosError(`timeout ${timeout}
|
|
4001
|
+
onabort(new AxiosError$1(`timeout of ${timeout}ms exceeded`, AxiosError$1.ETIMEDOUT));
|
|
4015
4002
|
}, timeout);
|
|
4016
4003
|
|
|
4017
4004
|
const unsubscribe = () => {
|
|
@@ -4197,7 +4184,7 @@ const factory = (env) => {
|
|
|
4197
4184
|
return method.call(res);
|
|
4198
4185
|
}
|
|
4199
4186
|
|
|
4200
|
-
throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
|
|
4187
|
+
throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
|
|
4201
4188
|
});
|
|
4202
4189
|
});
|
|
4203
4190
|
})());
|
|
@@ -4363,14 +4350,14 @@ const factory = (env) => {
|
|
|
4363
4350
|
|
|
4364
4351
|
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
|
4365
4352
|
throw Object.assign(
|
|
4366
|
-
new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
|
|
4353
|
+
new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request),
|
|
4367
4354
|
{
|
|
4368
4355
|
cause: err.cause || err
|
|
4369
4356
|
}
|
|
4370
4357
|
)
|
|
4371
4358
|
}
|
|
4372
4359
|
|
|
4373
|
-
throw AxiosError.from(err, err && err.code, config, request);
|
|
4360
|
+
throw AxiosError$1.from(err, err && err.code, config, request);
|
|
4374
4361
|
}
|
|
4375
4362
|
}
|
|
4376
4363
|
};
|
|
@@ -4475,7 +4462,7 @@ function getAdapter(adapters, config) {
|
|
|
4475
4462
|
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
4476
4463
|
|
|
4477
4464
|
if (adapter === undefined) {
|
|
4478
|
-
throw new AxiosError(`Unknown adapter '${id}'`);
|
|
4465
|
+
throw new AxiosError$1(`Unknown adapter '${id}'`);
|
|
4479
4466
|
}
|
|
4480
4467
|
}
|
|
4481
4468
|
|
|
@@ -4496,7 +4483,7 @@ function getAdapter(adapters, config) {
|
|
|
4496
4483
|
(reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
|
|
4497
4484
|
'as no adapter specified';
|
|
4498
4485
|
|
|
4499
|
-
throw new AxiosError(
|
|
4486
|
+
throw new AxiosError$1(
|
|
4500
4487
|
`There is no suitable adapter to dispatch the request ` + s,
|
|
4501
4488
|
'ERR_NOT_SUPPORT'
|
|
4502
4489
|
);
|
|
@@ -4535,7 +4522,7 @@ function throwIfCancellationRequested(config) {
|
|
|
4535
4522
|
}
|
|
4536
4523
|
|
|
4537
4524
|
if (config.signal && config.signal.aborted) {
|
|
4538
|
-
throw new CanceledError(null, config);
|
|
4525
|
+
throw new CanceledError$1(null, config);
|
|
4539
4526
|
}
|
|
4540
4527
|
}
|
|
4541
4528
|
|
|
@@ -4623,9 +4610,9 @@ validators$1.transitional = function transitional(validator, version, message) {
|
|
|
4623
4610
|
// eslint-disable-next-line func-names
|
|
4624
4611
|
return (value, opt, opts) => {
|
|
4625
4612
|
if (validator === false) {
|
|
4626
|
-
throw new AxiosError(
|
|
4613
|
+
throw new AxiosError$1(
|
|
4627
4614
|
formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
|
|
4628
|
-
AxiosError.ERR_DEPRECATED
|
|
4615
|
+
AxiosError$1.ERR_DEPRECATED
|
|
4629
4616
|
);
|
|
4630
4617
|
}
|
|
4631
4618
|
|
|
@@ -4664,7 +4651,7 @@ validators$1.spelling = function spelling(correctSpelling) {
|
|
|
4664
4651
|
|
|
4665
4652
|
function assertOptions(options, schema, allowUnknown) {
|
|
4666
4653
|
if (typeof options !== 'object') {
|
|
4667
|
-
throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
|
|
4654
|
+
throw new AxiosError$1('options must be an object', AxiosError$1.ERR_BAD_OPTION_VALUE);
|
|
4668
4655
|
}
|
|
4669
4656
|
const keys = Object.keys(options);
|
|
4670
4657
|
let i = keys.length;
|
|
@@ -4675,12 +4662,12 @@ function assertOptions(options, schema, allowUnknown) {
|
|
|
4675
4662
|
const value = options[opt];
|
|
4676
4663
|
const result = value === undefined || validator(value, opt, options);
|
|
4677
4664
|
if (result !== true) {
|
|
4678
|
-
throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
|
|
4665
|
+
throw new AxiosError$1('option ' + opt + ' must be ' + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
|
|
4679
4666
|
}
|
|
4680
4667
|
continue;
|
|
4681
4668
|
}
|
|
4682
4669
|
if (allowUnknown !== true) {
|
|
4683
|
-
throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
|
|
4670
|
+
throw new AxiosError$1('Unknown option ' + opt, AxiosError$1.ERR_BAD_OPTION);
|
|
4684
4671
|
}
|
|
4685
4672
|
}
|
|
4686
4673
|
}
|
|
@@ -4838,8 +4825,13 @@ class Axios {
|
|
|
4838
4825
|
|
|
4839
4826
|
promise = Promise.resolve(config);
|
|
4840
4827
|
|
|
4828
|
+
let prevResult = config;
|
|
4841
4829
|
while (i < len) {
|
|
4842
|
-
promise = promise
|
|
4830
|
+
promise = promise
|
|
4831
|
+
.then(chain[i++])
|
|
4832
|
+
.then(result => { prevResult = result !== undefined ? result : prevResult; })
|
|
4833
|
+
.catch(chain[i++])
|
|
4834
|
+
.then(() => prevResult);
|
|
4843
4835
|
}
|
|
4844
4836
|
|
|
4845
4837
|
return promise;
|
|
@@ -4870,7 +4862,7 @@ class Axios {
|
|
|
4870
4862
|
len = responseInterceptorChain.length;
|
|
4871
4863
|
|
|
4872
4864
|
while (i < len) {
|
|
4873
|
-
promise = promise.then(responseInterceptorChain[i++]
|
|
4865
|
+
promise = promise.then(responseInterceptorChain[i++]).catch(responseInterceptorChain[i++]);
|
|
4874
4866
|
}
|
|
4875
4867
|
|
|
4876
4868
|
return promise;
|
|
@@ -4973,7 +4965,7 @@ class CancelToken {
|
|
|
4973
4965
|
return;
|
|
4974
4966
|
}
|
|
4975
4967
|
|
|
4976
|
-
token.reason = new CanceledError(message, config, request);
|
|
4968
|
+
token.reason = new CanceledError$1(message, config, request);
|
|
4977
4969
|
resolvePromise(token.reason);
|
|
4978
4970
|
});
|
|
4979
4971
|
}
|
|
@@ -5057,7 +5049,7 @@ const CancelToken$1 = CancelToken;
|
|
|
5057
5049
|
*
|
|
5058
5050
|
* ```js
|
|
5059
5051
|
* function f(x, y, z) {}
|
|
5060
|
-
*
|
|
5052
|
+
* const args = [1, 2, 3];
|
|
5061
5053
|
* f.apply(null, args);
|
|
5062
5054
|
* ```
|
|
5063
5055
|
*
|
|
@@ -5198,14 +5190,14 @@ const axios = createInstance(defaults$1);
|
|
|
5198
5190
|
axios.Axios = Axios$1;
|
|
5199
5191
|
|
|
5200
5192
|
// Expose Cancel & CancelToken
|
|
5201
|
-
axios.CanceledError = CanceledError;
|
|
5193
|
+
axios.CanceledError = CanceledError$1;
|
|
5202
5194
|
axios.CancelToken = CancelToken$1;
|
|
5203
5195
|
axios.isCancel = isCancel;
|
|
5204
5196
|
axios.VERSION = VERSION;
|
|
5205
5197
|
axios.toFormData = toFormData;
|
|
5206
5198
|
|
|
5207
5199
|
// Expose AxiosError class
|
|
5208
|
-
axios.AxiosError = AxiosError;
|
|
5200
|
+
axios.AxiosError = AxiosError$1;
|
|
5209
5201
|
|
|
5210
5202
|
// alias for CanceledError for backward compatibility
|
|
5211
5203
|
axios.Cancel = axios.CanceledError;
|