axios 1.18.0 → 1.19.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 +32 -0
- package/README.md +192 -23
- package/dist/axios.js +410 -101
- package/dist/axios.min.js +3 -3
- package/dist/axios.min.js.map +1 -1
- package/dist/browser/axios.cjs +484 -119
- package/dist/esm/axios.js +484 -119
- package/dist/esm/axios.min.js +2 -2
- package/dist/esm/axios.min.js.map +1 -1
- package/dist/node/axios.cjs +589 -139
- package/index.d.cts +114 -74
- package/index.d.ts +112 -68
- package/lib/adapters/adapters.js +1 -1
- package/lib/adapters/fetch.js +27 -12
- package/lib/adapters/http.js +95 -34
- package/lib/adapters/xhr.js +1 -0
- package/lib/core/Axios.js +24 -6
- package/lib/core/AxiosError.js +46 -3
- package/lib/core/AxiosHeaders.js +124 -1
- package/lib/core/buildFullPath.js +45 -7
- package/lib/core/mergeConfig.js +19 -3
- package/lib/core/setFormDataHeaders.js +27 -0
- package/lib/env/data.js +1 -1
- package/lib/helpers/AxiosURLSearchParams.js +1 -3
- package/lib/helpers/HttpStatusCode.js +1 -0
- package/lib/helpers/buildURL.js +1 -0
- package/lib/helpers/combineURLs.js +11 -3
- package/lib/helpers/composeSignals.js +12 -1
- package/lib/helpers/cookies.js +5 -1
- package/lib/helpers/estimateDataURLDecodedBytes.js +115 -54
- package/lib/helpers/formDataToJSON.js +11 -5
- package/lib/helpers/fromDataURI.js +4 -2
- package/lib/helpers/parseHeaders.js +5 -3
- package/lib/helpers/progressEventReducer.js +3 -3
- package/lib/helpers/resolveConfig.js +10 -19
- package/lib/helpers/shouldBypassProxy.js +120 -1
- package/lib/helpers/toFormData.js +8 -1
- package/lib/helpers/validator.js +1 -1
- package/lib/platform/node/classes/Buffer.js +11 -0
- package/lib/utils.js +17 -5
- package/package.json +22 -20
package/dist/axios.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Axios v1.
|
|
1
|
+
/*! Axios v1.19.0 Copyright (c) 2026 Matt Zabriskie and contributors */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -825,6 +825,7 @@
|
|
|
825
825
|
* @returns {boolean} True if value is a FileList, otherwise false
|
|
826
826
|
*/
|
|
827
827
|
var isFileList = kindOfTest('FileList');
|
|
828
|
+
var isSet = kindOfTest('Set');
|
|
828
829
|
|
|
829
830
|
/**
|
|
830
831
|
* Determine if a value is a Stream
|
|
@@ -1354,11 +1355,29 @@
|
|
|
1354
1355
|
if (!('toJSON' in source)) {
|
|
1355
1356
|
// add-on descent / delete-on-ascent: preserves path semantics, so DAG nodes serialise at every occurrence (see #7230).
|
|
1356
1357
|
visited.add(source);
|
|
1357
|
-
var target
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1358
|
+
var target;
|
|
1359
|
+
if (isSet(source)) {
|
|
1360
|
+
target = [];
|
|
1361
|
+
var _iterator2 = _createForOfIteratorHelper(source),
|
|
1362
|
+
_step;
|
|
1363
|
+
try {
|
|
1364
|
+
for (_iterator2.s(); !(_step = _iterator2.n()).done;) {
|
|
1365
|
+
var value = _step.value;
|
|
1366
|
+
var reducedValue = _visit(value);
|
|
1367
|
+
!isUndefined(reducedValue) && target.push(reducedValue);
|
|
1368
|
+
}
|
|
1369
|
+
} catch (err) {
|
|
1370
|
+
_iterator2.e(err);
|
|
1371
|
+
} finally {
|
|
1372
|
+
_iterator2.f();
|
|
1373
|
+
}
|
|
1374
|
+
} else {
|
|
1375
|
+
target = isArray(source) ? [] : {};
|
|
1376
|
+
forEach(source, function (value, key) {
|
|
1377
|
+
var reducedValue = _visit(value);
|
|
1378
|
+
!isUndefined(reducedValue) && (target[key] = reducedValue);
|
|
1379
|
+
});
|
|
1380
|
+
}
|
|
1362
1381
|
visited["delete"](source);
|
|
1363
1382
|
return target;
|
|
1364
1383
|
}
|
|
@@ -1539,17 +1558,18 @@
|
|
|
1539
1558
|
i = line.indexOf(':');
|
|
1540
1559
|
key = line.substring(0, i).trim().toLowerCase();
|
|
1541
1560
|
val = line.substring(i + 1).trim();
|
|
1542
|
-
|
|
1561
|
+
var hasKey = utils$1.hasOwnProp(parsed, key);
|
|
1562
|
+
if (!key || hasKey && utils$1.hasOwnProp(ignoreDuplicateOf, key)) {
|
|
1543
1563
|
return;
|
|
1544
1564
|
}
|
|
1545
1565
|
if (key === 'set-cookie') {
|
|
1546
|
-
if (
|
|
1566
|
+
if (hasKey) {
|
|
1547
1567
|
parsed[key].push(val);
|
|
1548
1568
|
} else {
|
|
1549
1569
|
parsed[key] = [val];
|
|
1550
1570
|
}
|
|
1551
1571
|
} else {
|
|
1552
|
-
parsed[key] =
|
|
1572
|
+
parsed[key] = hasKey ? parsed[key] + ', ' + val : val;
|
|
1553
1573
|
}
|
|
1554
1574
|
});
|
|
1555
1575
|
return parsed;
|
|
@@ -1621,6 +1641,90 @@
|
|
|
1621
1641
|
}
|
|
1622
1642
|
return tokens;
|
|
1623
1643
|
}
|
|
1644
|
+
var parameterNameRE = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
|
|
1645
|
+
function trimOWS(value) {
|
|
1646
|
+
var start = 0;
|
|
1647
|
+
var end = value.length;
|
|
1648
|
+
while (start < end) {
|
|
1649
|
+
var code = value.charCodeAt(start);
|
|
1650
|
+
if (code !== 0x09 && code !== 0x20) {
|
|
1651
|
+
break;
|
|
1652
|
+
}
|
|
1653
|
+
start += 1;
|
|
1654
|
+
}
|
|
1655
|
+
while (end > start) {
|
|
1656
|
+
var _code = value.charCodeAt(end - 1);
|
|
1657
|
+
if (_code !== 0x09 && _code !== 0x20) {
|
|
1658
|
+
break;
|
|
1659
|
+
}
|
|
1660
|
+
end -= 1;
|
|
1661
|
+
}
|
|
1662
|
+
return start === 0 && end === value.length ? value : value.slice(start, end);
|
|
1663
|
+
}
|
|
1664
|
+
function decodeQuotedString(value) {
|
|
1665
|
+
var last = value.length - 1;
|
|
1666
|
+
if (last < 1 || value.charCodeAt(0) !== 0x22 || value.charCodeAt(last) !== 0x22) {
|
|
1667
|
+
return value;
|
|
1668
|
+
}
|
|
1669
|
+
var decoded = '';
|
|
1670
|
+
for (var i = 1; i < last; i++) {
|
|
1671
|
+
var code = value.charCodeAt(i);
|
|
1672
|
+
if (code === 0x22) {
|
|
1673
|
+
return value;
|
|
1674
|
+
}
|
|
1675
|
+
if (code === 0x5c) {
|
|
1676
|
+
i += 1;
|
|
1677
|
+
if (i >= last) {
|
|
1678
|
+
return value;
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
decoded += value[i];
|
|
1682
|
+
}
|
|
1683
|
+
return decoded;
|
|
1684
|
+
}
|
|
1685
|
+
function _parseParameters(value) {
|
|
1686
|
+
var parameters = Object.create(null);
|
|
1687
|
+
var str = String(value);
|
|
1688
|
+
var start = 0;
|
|
1689
|
+
var quoted = false;
|
|
1690
|
+
var escaped = false;
|
|
1691
|
+
function parseParameter(end) {
|
|
1692
|
+
var part = trimOWS(str.slice(start, end));
|
|
1693
|
+
var equals = part.indexOf('=');
|
|
1694
|
+
if (equals < 1) {
|
|
1695
|
+
return;
|
|
1696
|
+
}
|
|
1697
|
+
var name = trimOWS(part.slice(0, equals));
|
|
1698
|
+
if (!parameterNameRE.test(name)) {
|
|
1699
|
+
return;
|
|
1700
|
+
}
|
|
1701
|
+
var normalizedName = name.toLowerCase();
|
|
1702
|
+
if (normalizedName === '__proto__' || normalizedName === 'constructor' || normalizedName === 'prototype') {
|
|
1703
|
+
return;
|
|
1704
|
+
}
|
|
1705
|
+
var parameterValue = trimOWS(part.slice(equals + 1));
|
|
1706
|
+
parameters[normalizedName] = decodeQuotedString(parameterValue);
|
|
1707
|
+
}
|
|
1708
|
+
for (var i = 0; i < str.length; i++) {
|
|
1709
|
+
var code = str.charCodeAt(i);
|
|
1710
|
+
if (quoted) {
|
|
1711
|
+
if (escaped) {
|
|
1712
|
+
escaped = false;
|
|
1713
|
+
} else if (code === 0x5c) {
|
|
1714
|
+
escaped = true;
|
|
1715
|
+
} else if (code === 0x22) {
|
|
1716
|
+
quoted = false;
|
|
1717
|
+
}
|
|
1718
|
+
} else if (code === 0x22) {
|
|
1719
|
+
quoted = true;
|
|
1720
|
+
} else if (code === 0x2c || code === 0x3b) {
|
|
1721
|
+
parseParameter(i);
|
|
1722
|
+
start = i + 1;
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
parseParameter(str.length);
|
|
1726
|
+
return parameters;
|
|
1727
|
+
}
|
|
1624
1728
|
var isValidHeaderName = function isValidHeaderName(str) {
|
|
1625
1729
|
return /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
1626
1730
|
};
|
|
@@ -1845,7 +1949,8 @@
|
|
|
1845
1949
|
}, {
|
|
1846
1950
|
key: "getSetCookie",
|
|
1847
1951
|
value: function getSetCookie() {
|
|
1848
|
-
|
|
1952
|
+
var value = this.get('set-cookie');
|
|
1953
|
+
return utils$1.isArray(value) ? value : value == null || value === false ? [] : [value];
|
|
1849
1954
|
}
|
|
1850
1955
|
}, {
|
|
1851
1956
|
key: Symbol.toStringTag,
|
|
@@ -1857,6 +1962,11 @@
|
|
|
1857
1962
|
value: function from(thing) {
|
|
1858
1963
|
return thing instanceof this ? thing : new this(thing);
|
|
1859
1964
|
}
|
|
1965
|
+
}, {
|
|
1966
|
+
key: "parseParameters",
|
|
1967
|
+
value: function parseParameters(value) {
|
|
1968
|
+
return _parseParameters(value);
|
|
1969
|
+
}
|
|
1860
1970
|
}, {
|
|
1861
1971
|
key: "concat",
|
|
1862
1972
|
value: function concat(first) {
|
|
@@ -1967,6 +2077,23 @@
|
|
|
1967
2077
|
};
|
|
1968
2078
|
return _visit(config);
|
|
1969
2079
|
}
|
|
2080
|
+
function stringifySafely$1(value) {
|
|
2081
|
+
try {
|
|
2082
|
+
return String(value);
|
|
2083
|
+
} catch (err) {
|
|
2084
|
+
return '';
|
|
2085
|
+
}
|
|
2086
|
+
}
|
|
2087
|
+
function aggregateErrorMessage(error) {
|
|
2088
|
+
var message = error.errors.map(function (entry) {
|
|
2089
|
+
try {
|
|
2090
|
+
return entry && entry.message ? stringifySafely$1(entry.message) : stringifySafely$1(entry);
|
|
2091
|
+
} catch (err) {
|
|
2092
|
+
return '';
|
|
2093
|
+
}
|
|
2094
|
+
}).filter(Boolean).join('; ');
|
|
2095
|
+
return message || error.name || 'AggregateError';
|
|
2096
|
+
}
|
|
1970
2097
|
var AxiosError = /*#__PURE__*/function (_Error) {
|
|
1971
2098
|
/**
|
|
1972
2099
|
* Create an Error with the specified message, config, error code, request and response.
|
|
@@ -2039,8 +2166,27 @@
|
|
|
2039
2166
|
}], [{
|
|
2040
2167
|
key: "from",
|
|
2041
2168
|
value: function from(error, code, config, request, response, customProps) {
|
|
2042
|
-
|
|
2043
|
-
|
|
2169
|
+
// `AggregateError` (thrown by Node on dual-stack/Happy-Eyeballs connection
|
|
2170
|
+
// failures) has an empty `message`; its detail lives in `errors[]`. Without
|
|
2171
|
+
// this, the wrapped error surfaces with a blank message (see #6721).
|
|
2172
|
+
var message = error.message;
|
|
2173
|
+
if (!message && utils$1.isArray(error.errors) && error.errors.length) {
|
|
2174
|
+
message = aggregateErrorMessage(error);
|
|
2175
|
+
}
|
|
2176
|
+
var axiosError = new AxiosError(message, code || error.code, config, request, response);
|
|
2177
|
+
// Match native `Error` `cause` semantics: non-enumerable. The wrapped
|
|
2178
|
+
// error often carries circular internals (sockets, requests, agents), so
|
|
2179
|
+
// an enumerable `cause` makes structured loggers (pino/winston) and any
|
|
2180
|
+
// own-property walk throw "Converting circular structure to JSON".
|
|
2181
|
+
// Regression from #6982; see #7205. `__proto__: null` mirrors the
|
|
2182
|
+
// `message` descriptor below (prototype-pollution-safe descriptor).
|
|
2183
|
+
Object.defineProperty(axiosError, 'cause', {
|
|
2184
|
+
__proto__: null,
|
|
2185
|
+
value: error,
|
|
2186
|
+
writable: true,
|
|
2187
|
+
enumerable: false,
|
|
2188
|
+
configurable: true
|
|
2189
|
+
});
|
|
2044
2190
|
axiosError.name = error.name;
|
|
2045
2191
|
|
|
2046
2192
|
// Preserve status from the original error if not already set from response
|
|
@@ -2192,7 +2338,10 @@
|
|
|
2192
2338
|
throw new AxiosError('Blob is not supported. Use a Buffer instead.');
|
|
2193
2339
|
}
|
|
2194
2340
|
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
|
|
2195
|
-
|
|
2341
|
+
if (useBlob && typeof _Blob === 'function') {
|
|
2342
|
+
return new _Blob([value]);
|
|
2343
|
+
}
|
|
2344
|
+
throw new AxiosError('Blob is not supported. Use a Buffer instead.', AxiosError.ERR_NOT_SUPPORT);
|
|
2196
2345
|
}
|
|
2197
2346
|
return value;
|
|
2198
2347
|
}
|
|
@@ -2325,8 +2474,9 @@
|
|
|
2325
2474
|
this._pairs.push([name, value]);
|
|
2326
2475
|
};
|
|
2327
2476
|
prototype.toString = function toString(encoder) {
|
|
2477
|
+
var _this = this;
|
|
2328
2478
|
var _encode = encoder ? function (value) {
|
|
2329
|
-
return encoder.call(
|
|
2479
|
+
return encoder.call(_this, value, encode$1);
|
|
2330
2480
|
} : encode$1;
|
|
2331
2481
|
return this._pairs.map(function each(pair) {
|
|
2332
2482
|
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
|
@@ -2358,6 +2508,7 @@
|
|
|
2358
2508
|
if (!params) {
|
|
2359
2509
|
return url;
|
|
2360
2510
|
}
|
|
2511
|
+
url = url || '';
|
|
2361
2512
|
var _options = utils$1.isFunction(options) ? {
|
|
2362
2513
|
serialize: options
|
|
2363
2514
|
} : options;
|
|
@@ -2561,12 +2712,18 @@
|
|
|
2561
2712
|
* @returns An array of strings.
|
|
2562
2713
|
*/
|
|
2563
2714
|
function parsePropPath(name) {
|
|
2564
|
-
// foo[x][y][z]
|
|
2565
|
-
// foo.x.y.z
|
|
2566
|
-
//
|
|
2567
|
-
//
|
|
2715
|
+
// foo[x][y][z] -> ['foo', 'x', 'y', 'z']
|
|
2716
|
+
// foo.x.y.z -> ['foo', 'x', 'y', 'z']
|
|
2717
|
+
// A path is split on `.` and on `[...]` groups. A segment — whether written
|
|
2718
|
+
// in dot notation or captured inside brackets — may contain any character
|
|
2719
|
+
// except `.`, `[` and `]`, so a key like `user-name` or `user name` is kept
|
|
2720
|
+
// literal instead of being split (#5402). `.`, `[` and `]` keep their existing
|
|
2721
|
+
// meaning, e.g. `foo[bar.baz]` -> ['foo', 'bar', 'baz'] and `[]` is an array push.
|
|
2722
|
+
// Excluding `[` from the bracket group also makes the match fail fast at the
|
|
2723
|
+
// next `[`, so a malformed name cannot rescan to the end of the string from
|
|
2724
|
+
// every unmatched `[` — parsing stays linear in the length of the name.
|
|
2568
2725
|
var path = [];
|
|
2569
|
-
var pattern =
|
|
2726
|
+
var pattern = /[^.[\]]+|\[([^.[\]]*)]/g;
|
|
2570
2727
|
var match;
|
|
2571
2728
|
while ((match = pattern.exec(name)) !== null) {
|
|
2572
2729
|
throwIfDepthExceeded(path.length);
|
|
@@ -2923,7 +3080,7 @@
|
|
|
2923
3080
|
}
|
|
2924
3081
|
var rawLoaded = e.loaded;
|
|
2925
3082
|
var total = e.lengthComputable ? e.total : undefined;
|
|
2926
|
-
var loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
|
|
3083
|
+
var loaded = Math.max(0, total != null ? Math.min(rawLoaded, total) : rawLoaded);
|
|
2927
3084
|
var progressBytes = Math.max(0, loaded - bytesNotified);
|
|
2928
3085
|
var rate = _speedometer(progressBytes);
|
|
2929
3086
|
bytesNotified = Math.max(bytesNotified, loaded);
|
|
@@ -2951,11 +3108,12 @@
|
|
|
2951
3108
|
}, throttled[1]];
|
|
2952
3109
|
};
|
|
2953
3110
|
var asyncDecorator = function asyncDecorator(fn) {
|
|
3111
|
+
var scheduler = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : utils$1.asap;
|
|
2954
3112
|
return function () {
|
|
2955
3113
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2956
3114
|
args[_key] = arguments[_key];
|
|
2957
3115
|
}
|
|
2958
|
-
return
|
|
3116
|
+
return scheduler(function () {
|
|
2959
3117
|
return fn.apply(void 0, args);
|
|
2960
3118
|
});
|
|
2961
3119
|
};
|
|
@@ -3005,7 +3163,11 @@
|
|
|
3005
3163
|
var cookie = cookies[i].replace(/^\s+/, '');
|
|
3006
3164
|
var eq = cookie.indexOf('=');
|
|
3007
3165
|
if (eq !== -1 && cookie.slice(0, eq) === name) {
|
|
3008
|
-
|
|
3166
|
+
try {
|
|
3167
|
+
return decodeURIComponent(cookie.slice(eq + 1));
|
|
3168
|
+
} catch (e) {
|
|
3169
|
+
return cookie.slice(eq + 1);
|
|
3170
|
+
}
|
|
3009
3171
|
}
|
|
3010
3172
|
}
|
|
3011
3173
|
return null;
|
|
@@ -3049,7 +3211,14 @@
|
|
|
3049
3211
|
* @returns {string} The combined URL
|
|
3050
3212
|
*/
|
|
3051
3213
|
function combineURLs(baseURL, relativeURL) {
|
|
3052
|
-
|
|
3214
|
+
if (!relativeURL) {
|
|
3215
|
+
return baseURL;
|
|
3216
|
+
}
|
|
3217
|
+
var end = baseURL.length;
|
|
3218
|
+
while (end > 0 && baseURL.charCodeAt(end - 1) === 47) {
|
|
3219
|
+
end--;
|
|
3220
|
+
}
|
|
3221
|
+
return baseURL.slice(0, end) + '/' + relativeURL.replace(/^\/+/, '');
|
|
3053
3222
|
}
|
|
3054
3223
|
|
|
3055
3224
|
var malformedHttpProtocol = /^https?:(?!\/\/)/i;
|
|
@@ -3064,9 +3233,40 @@
|
|
|
3064
3233
|
function normalizeURLForProtocolCheck(url) {
|
|
3065
3234
|
return stripLeadingC0ControlOrSpace(url).replace(httpProtocolControlCharacters, '');
|
|
3066
3235
|
}
|
|
3236
|
+
|
|
3237
|
+
// Redact the parts of a URL that can carry secrets before it is embedded in an
|
|
3238
|
+
// error message. AxiosError.toJSON() serializes `message` verbatim and errors
|
|
3239
|
+
// are commonly logged, while the opt-in `config.redact` model only cleans
|
|
3240
|
+
// config keys — it cannot reach the message. Redact only the genuinely
|
|
3241
|
+
// sensitive substrings — userinfo (credentials), query parameter values and
|
|
3242
|
+
// fragment contents — with the same REDACTED marker the config redaction uses,
|
|
3243
|
+
// while keeping the scheme, host, path and parameter names so the offending
|
|
3244
|
+
// request stays accurately identifiable.
|
|
3245
|
+
function redactFragment(fragment) {
|
|
3246
|
+
if (!fragment) {
|
|
3247
|
+
return fragment;
|
|
3248
|
+
}
|
|
3249
|
+
return fragment.replace(/(^|&)([^=&]*=)?[^&]+/g, function (match, separator) {
|
|
3250
|
+
var parameterName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
3251
|
+
return "".concat(separator).concat(parameterName).concat(REDACTED);
|
|
3252
|
+
});
|
|
3253
|
+
}
|
|
3254
|
+
function redactSensitiveURLParts(url) {
|
|
3255
|
+
var redactedURL = url.replace(/^(https?:\/{0,2})[^/?#]*@/i, "$1".concat(REDACTED, "@"));
|
|
3256
|
+
var fragmentIndex = redactedURL.indexOf('#');
|
|
3257
|
+
var urlWithoutFragment = fragmentIndex === -1 ? redactedURL : redactedURL.slice(0, fragmentIndex);
|
|
3258
|
+
var redactedURLWithoutFragment = urlWithoutFragment.replace(/([?&][^=&#]*=)[^&#]*/g, "$1".concat(REDACTED));
|
|
3259
|
+
if (fragmentIndex === -1) {
|
|
3260
|
+
return redactedURLWithoutFragment;
|
|
3261
|
+
}
|
|
3262
|
+
return "".concat(redactedURLWithoutFragment, "#").concat(redactFragment(redactedURL.slice(fragmentIndex + 1)));
|
|
3263
|
+
}
|
|
3067
3264
|
function assertValidHttpProtocolURL(url, config) {
|
|
3068
|
-
if (typeof url === 'string'
|
|
3069
|
-
|
|
3265
|
+
if (typeof url === 'string') {
|
|
3266
|
+
var normalizedURL = normalizeURLForProtocolCheck(url);
|
|
3267
|
+
if (malformedHttpProtocol.test(normalizedURL)) {
|
|
3268
|
+
throw new AxiosError("Invalid URL ".concat(JSON.stringify(redactSensitiveURLParts(normalizedURL)), ": missing \"//\" after protocol"), AxiosError.ERR_INVALID_URL, config);
|
|
3269
|
+
}
|
|
3070
3270
|
}
|
|
3071
3271
|
}
|
|
3072
3272
|
|
|
@@ -3093,6 +3293,14 @@
|
|
|
3093
3293
|
var headersToObject = function headersToObject(thing) {
|
|
3094
3294
|
return thing instanceof AxiosHeaders ? _objectSpread2({}, thing) : thing;
|
|
3095
3295
|
};
|
|
3296
|
+
var ownEnumerableKeys = function ownEnumerableKeys(thing) {
|
|
3297
|
+
if (Object.getOwnPropertySymbols && Object.getOwnPropertyDescriptor) {
|
|
3298
|
+
return Object.keys(thing).concat(Object.getOwnPropertySymbols(thing).filter(function (symbol) {
|
|
3299
|
+
return Object.getOwnPropertyDescriptor(thing, symbol).enumerable;
|
|
3300
|
+
}));
|
|
3301
|
+
}
|
|
3302
|
+
return Object.keys(thing);
|
|
3303
|
+
};
|
|
3096
3304
|
|
|
3097
3305
|
/**
|
|
3098
3306
|
* Config-specific merge-function which creates a new config-object
|
|
@@ -3105,6 +3313,7 @@
|
|
|
3105
3313
|
*/
|
|
3106
3314
|
function mergeConfig(config1, config2) {
|
|
3107
3315
|
// eslint-disable-next-line no-param-reassign
|
|
3316
|
+
config1 = config1 || {};
|
|
3108
3317
|
config2 = config2 || {};
|
|
3109
3318
|
|
|
3110
3319
|
// Use a null-prototype object so that downstream reads such as `config.auth`
|
|
@@ -3216,7 +3425,7 @@
|
|
|
3216
3425
|
return mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true);
|
|
3217
3426
|
}
|
|
3218
3427
|
};
|
|
3219
|
-
utils$1.forEach(
|
|
3428
|
+
utils$1.forEach(ownEnumerableKeys(_objectSpread2(_objectSpread2({}, config1), config2)), function computeConfigValue(prop) {
|
|
3220
3429
|
if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
|
|
3221
3430
|
var merge = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
|
|
3222
3431
|
var a = utils$1.hasOwnProp(config1, prop) ? config1[prop] : undefined;
|
|
@@ -3235,12 +3444,24 @@
|
|
|
3235
3444
|
}
|
|
3236
3445
|
|
|
3237
3446
|
var FORM_DATA_CONTENT_HEADERS = ['content-type', 'content-length'];
|
|
3447
|
+
|
|
3448
|
+
/**
|
|
3449
|
+
* Apply the headers generated by a FormData implementation to the request headers,
|
|
3450
|
+
* honoring the `formDataHeaderPolicy` option: with 'content-only', copy only the
|
|
3451
|
+
* content-* headers; otherwise merge all of them.
|
|
3452
|
+
*
|
|
3453
|
+
* @param {AxiosHeaders} headers - the request headers to mutate
|
|
3454
|
+
* @param {Object | null | undefined} formHeaders - headers produced by the FormData implementation
|
|
3455
|
+
* @param {String} [policy] - the resolved `formDataHeaderPolicy` config value
|
|
3456
|
+
*
|
|
3457
|
+
* @returns {void}
|
|
3458
|
+
*/
|
|
3238
3459
|
function setFormDataHeaders(headers, formHeaders, policy) {
|
|
3239
3460
|
if (policy !== 'content-only') {
|
|
3240
3461
|
headers.set(formHeaders);
|
|
3241
3462
|
return;
|
|
3242
3463
|
}
|
|
3243
|
-
Object.entries(formHeaders).forEach(function (_ref) {
|
|
3464
|
+
Object.entries(formHeaders || {}).forEach(function (_ref) {
|
|
3244
3465
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
3245
3466
|
key = _ref2[0],
|
|
3246
3467
|
val = _ref2[1];
|
|
@@ -3287,7 +3508,11 @@
|
|
|
3287
3508
|
if (auth) {
|
|
3288
3509
|
var username = utils$1.getSafeProp(auth, 'username') || '';
|
|
3289
3510
|
var password = utils$1.getSafeProp(auth, 'password') || '';
|
|
3290
|
-
|
|
3511
|
+
try {
|
|
3512
|
+
headers.set('Authorization', 'Basic ' + btoa(username + ':' + (password ? encodeUTF8$1(password) : '')));
|
|
3513
|
+
} catch (e) {
|
|
3514
|
+
throw AxiosError.from(e, AxiosError.ERR_BAD_OPTION_VALUE, config);
|
|
3515
|
+
}
|
|
3291
3516
|
}
|
|
3292
3517
|
if (utils$1.isFormData(data)) {
|
|
3293
3518
|
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv || utils$1.isReactNative(data)) {
|
|
@@ -3492,6 +3717,7 @@
|
|
|
3492
3717
|
var protocol = parseProtocol(_config.url);
|
|
3493
3718
|
if (protocol && !platform.protocols.includes(protocol)) {
|
|
3494
3719
|
reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
|
|
3720
|
+
done();
|
|
3495
3721
|
return;
|
|
3496
3722
|
}
|
|
3497
3723
|
|
|
@@ -3531,7 +3757,16 @@
|
|
|
3531
3757
|
signals = null;
|
|
3532
3758
|
};
|
|
3533
3759
|
signals.forEach(function (signal) {
|
|
3534
|
-
|
|
3760
|
+
if (aborted) {
|
|
3761
|
+
return;
|
|
3762
|
+
}
|
|
3763
|
+
if (signal.aborted) {
|
|
3764
|
+
onabort.call(signal);
|
|
3765
|
+
return;
|
|
3766
|
+
}
|
|
3767
|
+
signal.addEventListener('abort', onabort, {
|
|
3768
|
+
once: true
|
|
3769
|
+
});
|
|
3535
3770
|
});
|
|
3536
3771
|
var signal = controller.signal;
|
|
3537
3772
|
signal.unsubscribe = function () {
|
|
@@ -3744,13 +3979,11 @@
|
|
|
3744
3979
|
};
|
|
3745
3980
|
|
|
3746
3981
|
/**
|
|
3747
|
-
* Estimate
|
|
3748
|
-
* -
|
|
3749
|
-
*
|
|
3750
|
-
*
|
|
3751
|
-
*
|
|
3752
|
-
* @param {string} url
|
|
3753
|
-
* @returns {number}
|
|
3982
|
+
* Estimate data: URL byte lengths *without* allocating large buffers.
|
|
3983
|
+
* - Fetch percent-decodes a base64 body before decoding it.
|
|
3984
|
+
* - Node's Buffer.from(body, 'base64') sizes its backing allocation from the
|
|
3985
|
+
* raw body, including ignored characters and content after padding.
|
|
3986
|
+
* - Non-base64 data is percent-decoded and then encoded as UTF-8.
|
|
3754
3987
|
*/
|
|
3755
3988
|
var isHexDigit = function isHexDigit(charCode) {
|
|
3756
3989
|
return charCode >= 48 && charCode <= 57 || charCode >= 65 && charCode <= 70 || charCode >= 97 && charCode <= 102;
|
|
@@ -3758,7 +3991,80 @@
|
|
|
3758
3991
|
var isPercentEncodedByte = function isPercentEncodedByte(str, i, len) {
|
|
3759
3992
|
return i + 2 < len && isHexDigit(str.charCodeAt(i + 1)) && isHexDigit(str.charCodeAt(i + 2));
|
|
3760
3993
|
};
|
|
3761
|
-
function
|
|
3994
|
+
var hexValue = function hexValue(charCode) {
|
|
3995
|
+
return charCode <= 57 ? charCode - 48 : (charCode & 0xdf) - 55;
|
|
3996
|
+
};
|
|
3997
|
+
var isBase64Char = function isBase64Char(charCode) {
|
|
3998
|
+
return charCode >= 65 && charCode <= 90 ||
|
|
3999
|
+
// A-Z
|
|
4000
|
+
charCode >= 97 && charCode <= 122 ||
|
|
4001
|
+
// a-z
|
|
4002
|
+
charCode >= 48 && charCode <= 57 ||
|
|
4003
|
+
// 0-9
|
|
4004
|
+
charCode === 43 ||
|
|
4005
|
+
// +
|
|
4006
|
+
charCode === 47 ||
|
|
4007
|
+
// /
|
|
4008
|
+
charCode === 45 ||
|
|
4009
|
+
// - (base64url)
|
|
4010
|
+
charCode === 95;
|
|
4011
|
+
}; // _ (base64url)
|
|
4012
|
+
|
|
4013
|
+
var isBase64Whitespace = function isBase64Whitespace(charCode) {
|
|
4014
|
+
return charCode === 9 || charCode === 10 || charCode === 12 || charCode === 13 || charCode === 32;
|
|
4015
|
+
};
|
|
4016
|
+
var base64Bytes = function base64Bytes(significant) {
|
|
4017
|
+
var groups = Math.floor(significant / 4);
|
|
4018
|
+
var remainder = significant % 4;
|
|
4019
|
+
return groups * 3 + (remainder === 2 ? 1 : remainder === 3 ? 2 : 0);
|
|
4020
|
+
};
|
|
4021
|
+
|
|
4022
|
+
// Buffer.byteLength(body, 'base64') uses the raw string length as an allocation
|
|
4023
|
+
// upper bound even when Buffer.from later ignores characters or stops at '='.
|
|
4024
|
+
var estimateBase64BufferAllocation = function estimateBase64BufferAllocation(body) {
|
|
4025
|
+
var len = body.length;
|
|
4026
|
+
var padding = 0;
|
|
4027
|
+
if (len > 0 && body.charCodeAt(len - 1) === 61 /* '=' */) {
|
|
4028
|
+
padding++;
|
|
4029
|
+
if (len > 1 && body.charCodeAt(len - 2) === 61 /* '=' */) {
|
|
4030
|
+
padding++;
|
|
4031
|
+
}
|
|
4032
|
+
}
|
|
4033
|
+
return Math.floor((len - padding) * 3 / 4);
|
|
4034
|
+
};
|
|
4035
|
+
var estimatePercentDecodedBase64Bytes = function estimatePercentDecodedBase64Bytes(body) {
|
|
4036
|
+
var len = body.length;
|
|
4037
|
+
var significant = 0;
|
|
4038
|
+
var padding = 0;
|
|
4039
|
+
var invalid = false;
|
|
4040
|
+
for (var i = 0; i < len; i++) {
|
|
4041
|
+
var code = body.charCodeAt(i);
|
|
4042
|
+
if (code === 37 /* '%' */ && isPercentEncodedByte(body, i, len)) {
|
|
4043
|
+
code = hexValue(body.charCodeAt(i + 1)) * 16 + hexValue(body.charCodeAt(i + 2));
|
|
4044
|
+
i += 2;
|
|
4045
|
+
}
|
|
4046
|
+
if (isBase64Whitespace(code)) {
|
|
4047
|
+
continue;
|
|
4048
|
+
}
|
|
4049
|
+
if (code === 61 /* '=' */) {
|
|
4050
|
+
padding++;
|
|
4051
|
+
continue;
|
|
4052
|
+
}
|
|
4053
|
+
if (!isBase64Char(code) || padding > 0) {
|
|
4054
|
+
invalid = true;
|
|
4055
|
+
continue;
|
|
4056
|
+
}
|
|
4057
|
+
significant++;
|
|
4058
|
+
}
|
|
4059
|
+
|
|
4060
|
+
// Fetch rejects malformed forgiving-base64 input. Returning the raw-size
|
|
4061
|
+
// allocation bound keeps that invalid input from becoming a pre-check bypass.
|
|
4062
|
+
if (invalid || padding > 2 || padding > 0 && (significant + padding) % 4 !== 0 || significant % 4 === 1) {
|
|
4063
|
+
return estimateBase64BufferAllocation(body);
|
|
4064
|
+
}
|
|
4065
|
+
return base64Bytes(significant);
|
|
4066
|
+
};
|
|
4067
|
+
var estimateDataURLBytes = function estimateDataURLBytes(url, estimateBase64) {
|
|
3762
4068
|
if (!url || typeof url !== 'string') return 0;
|
|
3763
4069
|
if (!url.startsWith('data:')) return 0;
|
|
3764
4070
|
var comma = url.indexOf(',');
|
|
@@ -3767,49 +4073,7 @@
|
|
|
3767
4073
|
var body = url.slice(comma + 1);
|
|
3768
4074
|
var isBase64 = /;base64/i.test(meta);
|
|
3769
4075
|
if (isBase64) {
|
|
3770
|
-
|
|
3771
|
-
var len = body.length; // cache length
|
|
3772
|
-
|
|
3773
|
-
for (var i = 0; i < len; i++) {
|
|
3774
|
-
if (body.charCodeAt(i) === 37 /* '%' */ && i + 2 < len) {
|
|
3775
|
-
var a = body.charCodeAt(i + 1);
|
|
3776
|
-
var b = body.charCodeAt(i + 2);
|
|
3777
|
-
var isHex = isHexDigit(a) && isHexDigit(b);
|
|
3778
|
-
if (isHex) {
|
|
3779
|
-
effectiveLen -= 2;
|
|
3780
|
-
i += 2;
|
|
3781
|
-
}
|
|
3782
|
-
}
|
|
3783
|
-
}
|
|
3784
|
-
var pad = 0;
|
|
3785
|
-
var idx = len - 1;
|
|
3786
|
-
var tailIsPct3D = function tailIsPct3D(j) {
|
|
3787
|
-
return j >= 2 && body.charCodeAt(j - 2) === 37 &&
|
|
3788
|
-
// '%'
|
|
3789
|
-
body.charCodeAt(j - 1) === 51 && (
|
|
3790
|
-
// '3'
|
|
3791
|
-
body.charCodeAt(j) === 68 || body.charCodeAt(j) === 100);
|
|
3792
|
-
}; // 'D' or 'd'
|
|
3793
|
-
|
|
3794
|
-
if (idx >= 0) {
|
|
3795
|
-
if (body.charCodeAt(idx) === 61 /* '=' */) {
|
|
3796
|
-
pad++;
|
|
3797
|
-
idx--;
|
|
3798
|
-
} else if (tailIsPct3D(idx)) {
|
|
3799
|
-
pad++;
|
|
3800
|
-
idx -= 3;
|
|
3801
|
-
}
|
|
3802
|
-
}
|
|
3803
|
-
if (pad === 1 && idx >= 0) {
|
|
3804
|
-
if (body.charCodeAt(idx) === 61 /* '=' */) {
|
|
3805
|
-
pad++;
|
|
3806
|
-
} else if (tailIsPct3D(idx)) {
|
|
3807
|
-
pad++;
|
|
3808
|
-
}
|
|
3809
|
-
}
|
|
3810
|
-
var groups = Math.floor(effectiveLen / 4);
|
|
3811
|
-
var _bytes = groups * 3 - (pad || 0);
|
|
3812
|
-
return _bytes > 0 ? _bytes : 0;
|
|
4076
|
+
return estimateBase64(body);
|
|
3813
4077
|
}
|
|
3814
4078
|
|
|
3815
4079
|
// Compute UTF-8 byte length directly from UTF-16 code units without allocating
|
|
@@ -3817,20 +4081,20 @@
|
|
|
3817
4081
|
// Valid %XX triplets count as one decoded byte; this matches the bytes that
|
|
3818
4082
|
// decodeURIComponent(body) would produce before Buffer re-encodes the string.
|
|
3819
4083
|
var bytes = 0;
|
|
3820
|
-
for (var
|
|
3821
|
-
var c = body.charCodeAt(
|
|
3822
|
-
if (c === 37 /* '%' */ && isPercentEncodedByte(body,
|
|
4084
|
+
for (var i = 0, len = body.length; i < len; i++) {
|
|
4085
|
+
var c = body.charCodeAt(i);
|
|
4086
|
+
if (c === 37 /* '%' */ && isPercentEncodedByte(body, i, len)) {
|
|
3823
4087
|
bytes += 1;
|
|
3824
|
-
|
|
4088
|
+
i += 2;
|
|
3825
4089
|
} else if (c < 0x80) {
|
|
3826
4090
|
bytes += 1;
|
|
3827
4091
|
} else if (c < 0x800) {
|
|
3828
4092
|
bytes += 2;
|
|
3829
|
-
} else if (c >= 0xd800 && c <= 0xdbff &&
|
|
3830
|
-
var next = body.charCodeAt(
|
|
4093
|
+
} else if (c >= 0xd800 && c <= 0xdbff && i + 1 < len) {
|
|
4094
|
+
var next = body.charCodeAt(i + 1);
|
|
3831
4095
|
if (next >= 0xdc00 && next <= 0xdfff) {
|
|
3832
4096
|
bytes += 4;
|
|
3833
|
-
|
|
4097
|
+
i++;
|
|
3834
4098
|
} else {
|
|
3835
4099
|
bytes += 3;
|
|
3836
4100
|
}
|
|
@@ -3839,9 +4103,21 @@
|
|
|
3839
4103
|
}
|
|
3840
4104
|
}
|
|
3841
4105
|
return bytes;
|
|
4106
|
+
};
|
|
4107
|
+
|
|
4108
|
+
/**
|
|
4109
|
+
* Estimate the percent-decoded payload size used by Fetch data: URLs.
|
|
4110
|
+
*
|
|
4111
|
+
* @param {string} url
|
|
4112
|
+
* @returns {number}
|
|
4113
|
+
*/
|
|
4114
|
+
function estimateDataURLDecodedBytes(url) {
|
|
4115
|
+
// Fetch removes URL fragments before processing a data: URL.
|
|
4116
|
+
var fragmentIndex = typeof url === 'string' ? url.indexOf('#') : -1;
|
|
4117
|
+
return estimateDataURLBytes(fragmentIndex === -1 ? url : url.slice(0, fragmentIndex), estimatePercentDecodedBase64Bytes);
|
|
3842
4118
|
}
|
|
3843
4119
|
|
|
3844
|
-
var VERSION = "1.
|
|
4120
|
+
var VERSION = "1.19.0";
|
|
3845
4121
|
|
|
3846
4122
|
var DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
3847
4123
|
var isFunction = utils$1.isFunction;
|
|
@@ -4045,7 +4321,7 @@
|
|
|
4045
4321
|
}();
|
|
4046
4322
|
return /*#__PURE__*/function () {
|
|
4047
4323
|
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(config) {
|
|
4048
|
-
var _resolveConfig, url, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, _resolveConfig$withCr, withCredentials, fetchOptions, maxContentLength, maxBodyLength, hasMaxContentLength, hasMaxBodyLength, own, _fetch, composedSignal, request, unsubscribe, requestContentLength, pendingBodyError, maxBodyLengthError, auth, configAuth, username, password, parsedURL, urlUsername, urlPassword, estimated, outboundLength, mustEnforceStreamBody, trackRequestStream, _request, contentTypeHeader, _ref5, _ref6, onProgress, flush, isCredentialsSupported, contentType, resolvedOptions, response, responseHeaders, declaredLength, isStreamResponse, options, responseContentLength, _ref7, _ref8, _onProgress, _flush, bytesRead, onChunkProgress, responseData, materializedSize, canceledError, _t3, _t4;
|
|
4324
|
+
var _resolveConfig, url, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, _resolveConfig$withCr, withCredentials, fetchOptions, maxContentLength, maxBodyLength, hasMaxContentLength, hasMaxBodyLength, own, _fetch, composedSignal, request, unsubscribe, requestContentLength, pendingBodyError, maxBodyLengthError, auth, configAuth, username, password, parsedURL, urlUsername, urlPassword, estimated, outboundLength, mustEnforceStreamBody, trackRequestStream, _request, contentTypeHeader, _ref5, _ref6, onProgress, flush, isCredentialsSupported, contentType, resolvedOptions, response, responseHeaders, declaredLength, isStreamResponse, options, responseContentLength, _ref7, _ref8, _onProgress, _flush, bytesRead, onChunkProgress, responseData, materializedSize, canceledError, networkError, _t3, _t4;
|
|
4049
4325
|
return _regenerator().w(function (_context4) {
|
|
4050
4326
|
while (1) switch (_context4.p = _context4.n) {
|
|
4051
4327
|
case 0:
|
|
@@ -4317,7 +4593,17 @@
|
|
|
4317
4593
|
canceledError = composedSignal.reason;
|
|
4318
4594
|
canceledError.config = config;
|
|
4319
4595
|
request && (canceledError.request = request);
|
|
4320
|
-
_t4 !== canceledError
|
|
4596
|
+
if (_t4 !== canceledError) {
|
|
4597
|
+
// Non-enumerable to match native Error `cause` semantics so loggers
|
|
4598
|
+
// don't recurse into circular fetch internals (see #7205).
|
|
4599
|
+
Object.defineProperty(canceledError, 'cause', {
|
|
4600
|
+
__proto__: null,
|
|
4601
|
+
value: _t4,
|
|
4602
|
+
writable: true,
|
|
4603
|
+
enumerable: false,
|
|
4604
|
+
configurable: true
|
|
4605
|
+
});
|
|
4606
|
+
}
|
|
4321
4607
|
throw canceledError;
|
|
4322
4608
|
case 17:
|
|
4323
4609
|
if (!pendingBodyError) {
|
|
@@ -4338,9 +4624,16 @@
|
|
|
4338
4624
|
_context4.n = 20;
|
|
4339
4625
|
break;
|
|
4340
4626
|
}
|
|
4341
|
-
|
|
4342
|
-
|
|
4627
|
+
networkError = new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request, _t4 && _t4.response); // Non-enumerable to match native Error `cause` semantics so loggers
|
|
4628
|
+
// don't recurse into circular fetch internals (see #7205).
|
|
4629
|
+
Object.defineProperty(networkError, 'cause', {
|
|
4630
|
+
__proto__: null,
|
|
4631
|
+
value: _t4.cause || _t4,
|
|
4632
|
+
writable: true,
|
|
4633
|
+
enumerable: false,
|
|
4634
|
+
configurable: true
|
|
4343
4635
|
});
|
|
4636
|
+
throw networkError;
|
|
4344
4637
|
case 20:
|
|
4345
4638
|
throw AxiosError.from(_t4, _t4 && _t4.code, config, request, _t4 && _t4.response);
|
|
4346
4639
|
case 21:
|
|
@@ -4472,7 +4765,7 @@
|
|
|
4472
4765
|
return "adapter ".concat(id, " ") + (state === false ? 'is not supported by the environment' : 'is not available in the build');
|
|
4473
4766
|
});
|
|
4474
4767
|
var s = length ? reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0]) : 'as no adapter specified';
|
|
4475
|
-
throw new AxiosError("There is no suitable adapter to dispatch the request " + s,
|
|
4768
|
+
throw new AxiosError("There is no suitable adapter to dispatch the request " + s, AxiosError.ERR_NOT_SUPPORT);
|
|
4476
4769
|
}
|
|
4477
4770
|
return adapter;
|
|
4478
4771
|
}
|
|
@@ -4615,7 +4908,7 @@
|
|
|
4615
4908
|
*/
|
|
4616
4909
|
|
|
4617
4910
|
function assertOptions(options, schema, allowUnknown) {
|
|
4618
|
-
if (_typeof(options) !== 'object') {
|
|
4911
|
+
if (_typeof(options) !== 'object' || options === null) {
|
|
4619
4912
|
throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
|
|
4620
4913
|
}
|
|
4621
4914
|
var keys = Object.keys(options);
|
|
@@ -4728,6 +5021,7 @@
|
|
|
4728
5021
|
}, {
|
|
4729
5022
|
key: "_request",
|
|
4730
5023
|
value: function _request(configOrUrl, config) {
|
|
5024
|
+
var _this = this;
|
|
4731
5025
|
/*eslint no-param-reassign:0*/
|
|
4732
5026
|
// Allow for axios('example/url'[, config]) a la fetch API
|
|
4733
5027
|
if (typeof configOrUrl === 'string') {
|
|
@@ -4825,16 +5119,31 @@
|
|
|
4825
5119
|
var onFulfilled = requestInterceptorChain[i++];
|
|
4826
5120
|
var onRejected = requestInterceptorChain[i++];
|
|
4827
5121
|
try {
|
|
4828
|
-
newConfig = onFulfilled(newConfig);
|
|
5122
|
+
newConfig = onFulfilled ? onFulfilled(newConfig) : newConfig;
|
|
4829
5123
|
} catch (error) {
|
|
4830
|
-
onRejected
|
|
5124
|
+
if (!onRejected) {
|
|
5125
|
+
promise = Promise.reject(error);
|
|
5126
|
+
break;
|
|
5127
|
+
}
|
|
5128
|
+
try {
|
|
5129
|
+
var rejectedResult = onRejected.call(this, error);
|
|
5130
|
+
if (utils$1.isThenable(rejectedResult)) {
|
|
5131
|
+
promise = Promise.resolve(rejectedResult).then(function () {
|
|
5132
|
+
return dispatchRequest.call(_this, newConfig);
|
|
5133
|
+
});
|
|
5134
|
+
}
|
|
5135
|
+
} catch (rejectedError) {
|
|
5136
|
+
promise = Promise.reject(rejectedError);
|
|
5137
|
+
}
|
|
4831
5138
|
break;
|
|
4832
5139
|
}
|
|
4833
5140
|
}
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
5141
|
+
if (!promise) {
|
|
5142
|
+
try {
|
|
5143
|
+
promise = dispatchRequest.call(this, newConfig);
|
|
5144
|
+
} catch (error) {
|
|
5145
|
+
promise = Promise.reject(error);
|
|
5146
|
+
}
|
|
4838
5147
|
}
|
|
4839
5148
|
i = 0;
|
|
4840
5149
|
len = responseInterceptorChain.length;
|
|
@@ -5114,6 +5423,7 @@
|
|
|
5114
5423
|
LoopDetected: 508,
|
|
5115
5424
|
NotExtended: 510,
|
|
5116
5425
|
NetworkAuthenticationRequired: 511,
|
|
5426
|
+
WebServerReturnsAnUnknownError: 520,
|
|
5117
5427
|
WebServerIsDown: 521,
|
|
5118
5428
|
ConnectionTimedOut: 522,
|
|
5119
5429
|
OriginIsUnreachable: 523,
|
|
@@ -5197,4 +5507,3 @@
|
|
|
5197
5507
|
return axios;
|
|
5198
5508
|
|
|
5199
5509
|
}));
|
|
5200
|
-
//# sourceMappingURL=axios.js.map
|