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/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
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -139,6 +139,24 @@
|
|
|
139
139
|
function _awaitAsyncGenerator(e) {
|
|
140
140
|
return new _OverloadYield(e, 0);
|
|
141
141
|
}
|
|
142
|
+
function _callSuper(t, o, e) {
|
|
143
|
+
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
|
|
144
|
+
}
|
|
145
|
+
function _construct(t, e, r) {
|
|
146
|
+
if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
|
|
147
|
+
var o = [null];
|
|
148
|
+
o.push.apply(o, e);
|
|
149
|
+
var p = new (t.bind.apply(t, o))();
|
|
150
|
+
return r && _setPrototypeOf(p, r.prototype), p;
|
|
151
|
+
}
|
|
152
|
+
function _isNativeReflectConstruct() {
|
|
153
|
+
try {
|
|
154
|
+
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
155
|
+
} catch (t) {}
|
|
156
|
+
return (_isNativeReflectConstruct = function () {
|
|
157
|
+
return !!t;
|
|
158
|
+
})();
|
|
159
|
+
}
|
|
142
160
|
function _iterableToArrayLimit(r, l) {
|
|
143
161
|
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
144
162
|
if (null != t) {
|
|
@@ -582,6 +600,82 @@
|
|
|
582
600
|
}
|
|
583
601
|
return obj;
|
|
584
602
|
}
|
|
603
|
+
function _inherits(subClass, superClass) {
|
|
604
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
605
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
606
|
+
}
|
|
607
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
608
|
+
constructor: {
|
|
609
|
+
value: subClass,
|
|
610
|
+
writable: true,
|
|
611
|
+
configurable: true
|
|
612
|
+
}
|
|
613
|
+
});
|
|
614
|
+
Object.defineProperty(subClass, "prototype", {
|
|
615
|
+
writable: false
|
|
616
|
+
});
|
|
617
|
+
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
618
|
+
}
|
|
619
|
+
function _getPrototypeOf(o) {
|
|
620
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
621
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
622
|
+
};
|
|
623
|
+
return _getPrototypeOf(o);
|
|
624
|
+
}
|
|
625
|
+
function _setPrototypeOf(o, p) {
|
|
626
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
627
|
+
o.__proto__ = p;
|
|
628
|
+
return o;
|
|
629
|
+
};
|
|
630
|
+
return _setPrototypeOf(o, p);
|
|
631
|
+
}
|
|
632
|
+
function _isNativeFunction(fn) {
|
|
633
|
+
try {
|
|
634
|
+
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
635
|
+
} catch (e) {
|
|
636
|
+
return typeof fn === "function";
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
function _wrapNativeSuper(Class) {
|
|
640
|
+
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
641
|
+
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
|
642
|
+
if (Class === null || !_isNativeFunction(Class)) return Class;
|
|
643
|
+
if (typeof Class !== "function") {
|
|
644
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
645
|
+
}
|
|
646
|
+
if (typeof _cache !== "undefined") {
|
|
647
|
+
if (_cache.has(Class)) return _cache.get(Class);
|
|
648
|
+
_cache.set(Class, Wrapper);
|
|
649
|
+
}
|
|
650
|
+
function Wrapper() {
|
|
651
|
+
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
|
652
|
+
}
|
|
653
|
+
Wrapper.prototype = Object.create(Class.prototype, {
|
|
654
|
+
constructor: {
|
|
655
|
+
value: Wrapper,
|
|
656
|
+
enumerable: false,
|
|
657
|
+
writable: true,
|
|
658
|
+
configurable: true
|
|
659
|
+
}
|
|
660
|
+
});
|
|
661
|
+
return _setPrototypeOf(Wrapper, Class);
|
|
662
|
+
};
|
|
663
|
+
return _wrapNativeSuper(Class);
|
|
664
|
+
}
|
|
665
|
+
function _assertThisInitialized(self) {
|
|
666
|
+
if (self === void 0) {
|
|
667
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
668
|
+
}
|
|
669
|
+
return self;
|
|
670
|
+
}
|
|
671
|
+
function _possibleConstructorReturn(self, call) {
|
|
672
|
+
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
673
|
+
return call;
|
|
674
|
+
} else if (call !== void 0) {
|
|
675
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
676
|
+
}
|
|
677
|
+
return _assertThisInitialized(self);
|
|
678
|
+
}
|
|
585
679
|
function _slicedToArray(arr, i) {
|
|
586
680
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
587
681
|
}
|
|
@@ -938,10 +1032,11 @@
|
|
|
938
1032
|
* If 'obj' is an Object callback will be called passing
|
|
939
1033
|
* the value, key, and complete object for each property.
|
|
940
1034
|
*
|
|
941
|
-
* @param {Object|Array} obj The object to iterate
|
|
1035
|
+
* @param {Object|Array<unknown>} obj The object to iterate
|
|
942
1036
|
* @param {Function} fn The callback to invoke for each item
|
|
943
1037
|
*
|
|
944
|
-
* @param {
|
|
1038
|
+
* @param {Object} [options]
|
|
1039
|
+
* @param {Boolean} [options.allOwnKeys = false]
|
|
945
1040
|
* @returns {any}
|
|
946
1041
|
*/
|
|
947
1042
|
function forEach(obj, fn) {
|
|
@@ -1016,7 +1111,7 @@
|
|
|
1016
1111
|
* Example:
|
|
1017
1112
|
*
|
|
1018
1113
|
* ```js
|
|
1019
|
-
*
|
|
1114
|
+
* const result = merge({foo: 123}, {foo: 456});
|
|
1020
1115
|
* console.log(result.foo); // outputs 456
|
|
1021
1116
|
* ```
|
|
1022
1117
|
*
|
|
@@ -1055,7 +1150,8 @@
|
|
|
1055
1150
|
* @param {Object} b The object to copy properties from
|
|
1056
1151
|
* @param {Object} thisArg The object to bind function to
|
|
1057
1152
|
*
|
|
1058
|
-
* @param {
|
|
1153
|
+
* @param {Object} [options]
|
|
1154
|
+
* @param {Boolean} [options.allOwnKeys]
|
|
1059
1155
|
* @returns {Object} The resulting value of object a
|
|
1060
1156
|
*/
|
|
1061
1157
|
var extend = function extend(a, b, thisArg) {
|
|
@@ -1063,9 +1159,19 @@
|
|
|
1063
1159
|
allOwnKeys = _ref3.allOwnKeys;
|
|
1064
1160
|
forEach(b, function (val, key) {
|
|
1065
1161
|
if (thisArg && isFunction$1(val)) {
|
|
1066
|
-
a
|
|
1162
|
+
Object.defineProperty(a, key, {
|
|
1163
|
+
value: bind(val, thisArg),
|
|
1164
|
+
writable: true,
|
|
1165
|
+
enumerable: true,
|
|
1166
|
+
configurable: true
|
|
1167
|
+
});
|
|
1067
1168
|
} else {
|
|
1068
|
-
a
|
|
1169
|
+
Object.defineProperty(a, key, {
|
|
1170
|
+
value: val,
|
|
1171
|
+
writable: true,
|
|
1172
|
+
enumerable: true,
|
|
1173
|
+
configurable: true
|
|
1174
|
+
});
|
|
1069
1175
|
}
|
|
1070
1176
|
}, {
|
|
1071
1177
|
allOwnKeys: allOwnKeys
|
|
@@ -1098,7 +1204,12 @@
|
|
|
1098
1204
|
*/
|
|
1099
1205
|
var inherits = function inherits(constructor, superConstructor, props, descriptors) {
|
|
1100
1206
|
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
|
1101
|
-
constructor.prototype
|
|
1207
|
+
Object.defineProperty(constructor.prototype, 'constructor', {
|
|
1208
|
+
value: constructor,
|
|
1209
|
+
writable: true,
|
|
1210
|
+
enumerable: false,
|
|
1211
|
+
configurable: true
|
|
1212
|
+
});
|
|
1102
1213
|
Object.defineProperty(constructor, 'super', {
|
|
1103
1214
|
value: superConstructor.prototype
|
|
1104
1215
|
});
|
|
@@ -1435,94 +1546,80 @@
|
|
|
1435
1546
|
isIterable: isIterable
|
|
1436
1547
|
};
|
|
1437
1548
|
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
}
|
|
1466
|
-
utils$1.inherits(AxiosError, Error, {
|
|
1467
|
-
toJSON: function toJSON() {
|
|
1468
|
-
return {
|
|
1469
|
-
// Standard
|
|
1470
|
-
message: this.message,
|
|
1471
|
-
name: this.name,
|
|
1472
|
-
// Microsoft
|
|
1473
|
-
description: this.description,
|
|
1474
|
-
number: this.number,
|
|
1475
|
-
// Mozilla
|
|
1476
|
-
fileName: this.fileName,
|
|
1477
|
-
lineNumber: this.lineNumber,
|
|
1478
|
-
columnNumber: this.columnNumber,
|
|
1479
|
-
stack: this.stack,
|
|
1480
|
-
// Axios
|
|
1481
|
-
config: utils$1.toJSONObject(this.config),
|
|
1482
|
-
code: this.code,
|
|
1483
|
-
status: this.status
|
|
1484
|
-
};
|
|
1485
|
-
}
|
|
1486
|
-
});
|
|
1487
|
-
var prototype$1 = AxiosError.prototype;
|
|
1488
|
-
var descriptors = {};
|
|
1489
|
-
['ERR_BAD_OPTION_VALUE', 'ERR_BAD_OPTION', 'ECONNABORTED', 'ETIMEDOUT', 'ERR_NETWORK', 'ERR_FR_TOO_MANY_REDIRECTS', 'ERR_DEPRECATED', 'ERR_BAD_RESPONSE', 'ERR_BAD_REQUEST', 'ERR_CANCELED', 'ERR_NOT_SUPPORT', 'ERR_INVALID_URL'
|
|
1490
|
-
// eslint-disable-next-line func-names
|
|
1491
|
-
].forEach(function (code) {
|
|
1492
|
-
descriptors[code] = {
|
|
1493
|
-
value: code
|
|
1494
|
-
};
|
|
1495
|
-
});
|
|
1496
|
-
Object.defineProperties(AxiosError, descriptors);
|
|
1497
|
-
Object.defineProperty(prototype$1, 'isAxiosError', {
|
|
1498
|
-
value: true
|
|
1499
|
-
});
|
|
1500
|
-
|
|
1501
|
-
// eslint-disable-next-line func-names
|
|
1502
|
-
AxiosError.from = function (error, code, config, request, response, customProps) {
|
|
1503
|
-
var axiosError = Object.create(prototype$1);
|
|
1504
|
-
utils$1.toFlatObject(error, axiosError, function filter(obj) {
|
|
1505
|
-
return obj !== Error.prototype;
|
|
1506
|
-
}, function (prop) {
|
|
1507
|
-
return prop !== 'isAxiosError';
|
|
1508
|
-
});
|
|
1509
|
-
var msg = error && error.message ? error.message : 'Error';
|
|
1510
|
-
|
|
1511
|
-
// Prefer explicit code; otherwise copy the low-level error's code (e.g. ECONNREFUSED)
|
|
1512
|
-
var errCode = code == null && error ? error.code : code;
|
|
1513
|
-
AxiosError.call(axiosError, msg, errCode, config, request, response);
|
|
1514
|
-
|
|
1515
|
-
// Chain the original error on the standard field; non-enumerable to avoid JSON noise
|
|
1516
|
-
if (error && axiosError.cause == null) {
|
|
1517
|
-
Object.defineProperty(axiosError, 'cause', {
|
|
1518
|
-
value: error,
|
|
1519
|
-
configurable: true
|
|
1520
|
-
});
|
|
1549
|
+
var AxiosError = /*#__PURE__*/function (_Error) {
|
|
1550
|
+
_inherits(AxiosError, _Error);
|
|
1551
|
+
/**
|
|
1552
|
+
* Create an Error with the specified message, config, error code, request and response.
|
|
1553
|
+
*
|
|
1554
|
+
* @param {string} message The error message.
|
|
1555
|
+
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
1556
|
+
* @param {Object} [config] The config.
|
|
1557
|
+
* @param {Object} [request] The request.
|
|
1558
|
+
* @param {Object} [response] The response.
|
|
1559
|
+
*
|
|
1560
|
+
* @returns {Error} The created error.
|
|
1561
|
+
*/
|
|
1562
|
+
function AxiosError(message, code, config, request, response) {
|
|
1563
|
+
var _this;
|
|
1564
|
+
_classCallCheck(this, AxiosError);
|
|
1565
|
+
_this = _callSuper(this, AxiosError, [message]);
|
|
1566
|
+
_this.name = 'AxiosError';
|
|
1567
|
+
_this.isAxiosError = true;
|
|
1568
|
+
code && (_this.code = code);
|
|
1569
|
+
config && (_this.config = config);
|
|
1570
|
+
request && (_this.request = request);
|
|
1571
|
+
if (response) {
|
|
1572
|
+
_this.response = response;
|
|
1573
|
+
_this.status = response.status;
|
|
1574
|
+
}
|
|
1575
|
+
return _this;
|
|
1521
1576
|
}
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1577
|
+
_createClass(AxiosError, [{
|
|
1578
|
+
key: "toJSON",
|
|
1579
|
+
value: function toJSON() {
|
|
1580
|
+
return {
|
|
1581
|
+
// Standard
|
|
1582
|
+
message: this.message,
|
|
1583
|
+
name: this.name,
|
|
1584
|
+
// Microsoft
|
|
1585
|
+
description: this.description,
|
|
1586
|
+
number: this.number,
|
|
1587
|
+
// Mozilla
|
|
1588
|
+
fileName: this.fileName,
|
|
1589
|
+
lineNumber: this.lineNumber,
|
|
1590
|
+
columnNumber: this.columnNumber,
|
|
1591
|
+
stack: this.stack,
|
|
1592
|
+
// Axios
|
|
1593
|
+
config: utils$1.toJSONObject(this.config),
|
|
1594
|
+
code: this.code,
|
|
1595
|
+
status: this.status
|
|
1596
|
+
};
|
|
1597
|
+
}
|
|
1598
|
+
}], [{
|
|
1599
|
+
key: "from",
|
|
1600
|
+
value: function from(error, code, config, request, response, customProps) {
|
|
1601
|
+
var axiosError = new AxiosError(error.message, code || error.code, config, request, response);
|
|
1602
|
+
axiosError.cause = error;
|
|
1603
|
+
axiosError.name = error.name;
|
|
1604
|
+
customProps && Object.assign(axiosError, customProps);
|
|
1605
|
+
return axiosError;
|
|
1606
|
+
}
|
|
1607
|
+
}]);
|
|
1608
|
+
return AxiosError;
|
|
1609
|
+
}( /*#__PURE__*/_wrapNativeSuper(Error)); // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
|
|
1610
|
+
AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
|
|
1611
|
+
AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
|
|
1612
|
+
AxiosError.ECONNABORTED = 'ECONNABORTED';
|
|
1613
|
+
AxiosError.ETIMEDOUT = 'ETIMEDOUT';
|
|
1614
|
+
AxiosError.ERR_NETWORK = 'ERR_NETWORK';
|
|
1615
|
+
AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
|
|
1616
|
+
AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
|
|
1617
|
+
AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
|
|
1618
|
+
AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
|
|
1619
|
+
AxiosError.ERR_CANCELED = 'ERR_CANCELED';
|
|
1620
|
+
AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
|
|
1621
|
+
AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
|
|
1622
|
+
var AxiosError$1 = AxiosError;
|
|
1526
1623
|
|
|
1527
1624
|
// eslint-disable-next-line strict
|
|
1528
1625
|
var httpAdapter = null;
|
|
@@ -1640,7 +1737,7 @@
|
|
|
1640
1737
|
return value.toString();
|
|
1641
1738
|
}
|
|
1642
1739
|
if (!useBlob && utils$1.isBlob(value)) {
|
|
1643
|
-
throw new AxiosError('Blob is not supported. Use a Buffer instead.');
|
|
1740
|
+
throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
|
|
1644
1741
|
}
|
|
1645
1742
|
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
|
|
1646
1743
|
return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
|
|
@@ -1780,22 +1877,19 @@
|
|
|
1780
1877
|
* @returns {string} The formatted url
|
|
1781
1878
|
*/
|
|
1782
1879
|
function buildURL(url, params, options) {
|
|
1783
|
-
/*eslint no-param-reassign:0*/
|
|
1784
1880
|
if (!params) {
|
|
1785
1881
|
return url;
|
|
1786
1882
|
}
|
|
1787
1883
|
var _encode = options && options.encode || encode;
|
|
1788
|
-
|
|
1789
|
-
options
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
}
|
|
1793
|
-
var serializeFn = options && options.serialize;
|
|
1884
|
+
var _options = utils$1.isFunction(options) ? {
|
|
1885
|
+
serialize: options
|
|
1886
|
+
} : options;
|
|
1887
|
+
var serializeFn = _options && _options.serialize;
|
|
1794
1888
|
var serializedParams;
|
|
1795
1889
|
if (serializeFn) {
|
|
1796
|
-
serializedParams = serializeFn(params,
|
|
1890
|
+
serializedParams = serializeFn(params, _options);
|
|
1797
1891
|
} else {
|
|
1798
|
-
serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params,
|
|
1892
|
+
serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, _options).toString(_encode);
|
|
1799
1893
|
}
|
|
1800
1894
|
if (serializedParams) {
|
|
1801
1895
|
var hashmarkIndex = url.indexOf("#");
|
|
@@ -1818,6 +1912,7 @@
|
|
|
1818
1912
|
*
|
|
1819
1913
|
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
1820
1914
|
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
1915
|
+
* @param {Object} options The options for the interceptor, synchronous and runWhen
|
|
1821
1916
|
*
|
|
1822
1917
|
* @return {Number} An ID used to remove interceptor later
|
|
1823
1918
|
*/
|
|
@@ -2126,7 +2221,7 @@
|
|
|
2126
2221
|
} catch (e) {
|
|
2127
2222
|
if (strictJSONParsing) {
|
|
2128
2223
|
if (e.name === 'SyntaxError') {
|
|
2129
|
-
throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
|
|
2224
|
+
throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
|
|
2130
2225
|
}
|
|
2131
2226
|
throw e;
|
|
2132
2227
|
}
|
|
@@ -2526,23 +2621,28 @@
|
|
|
2526
2621
|
return !!(value && value.__CANCEL__);
|
|
2527
2622
|
}
|
|
2528
2623
|
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2624
|
+
var CanceledError = /*#__PURE__*/function (_AxiosError) {
|
|
2625
|
+
_inherits(CanceledError, _AxiosError);
|
|
2626
|
+
/**
|
|
2627
|
+
* A `CanceledError` is an object that is thrown when an operation is canceled.
|
|
2628
|
+
*
|
|
2629
|
+
* @param {string=} message The message.
|
|
2630
|
+
* @param {Object=} config The config.
|
|
2631
|
+
* @param {Object=} request The request.
|
|
2632
|
+
*
|
|
2633
|
+
* @returns {CanceledError} The created error.
|
|
2634
|
+
*/
|
|
2635
|
+
function CanceledError(message, config, request) {
|
|
2636
|
+
var _this;
|
|
2637
|
+
_classCallCheck(this, CanceledError);
|
|
2638
|
+
_this = _callSuper(this, CanceledError, [message == null ? 'canceled' : message, AxiosError$1.ERR_CANCELED, config, request]);
|
|
2639
|
+
_this.name = 'CanceledError';
|
|
2640
|
+
_this.__CANCEL__ = true;
|
|
2641
|
+
return _this;
|
|
2642
|
+
}
|
|
2643
|
+
return _createClass(CanceledError);
|
|
2644
|
+
}(AxiosError$1);
|
|
2645
|
+
var CanceledError$1 = CanceledError;
|
|
2546
2646
|
|
|
2547
2647
|
/**
|
|
2548
2648
|
* Resolve or reject a Promise based on response status.
|
|
@@ -2558,7 +2658,7 @@
|
|
|
2558
2658
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
2559
2659
|
resolve(response);
|
|
2560
2660
|
} else {
|
|
2561
|
-
reject(new AxiosError('Request failed with status code ' + response.status, [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], response.config, response.request, response));
|
|
2661
|
+
reject(new AxiosError$1('Request failed with status code ' + response.status, [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], response.config, response.request, response));
|
|
2562
2662
|
}
|
|
2563
2663
|
}
|
|
2564
2664
|
|
|
@@ -2820,8 +2920,6 @@
|
|
|
2820
2920
|
}
|
|
2821
2921
|
return source;
|
|
2822
2922
|
}
|
|
2823
|
-
|
|
2824
|
-
// eslint-disable-next-line consistent-return
|
|
2825
2923
|
function mergeDeepProperties(a, b, prop, caseless) {
|
|
2826
2924
|
if (!utils$1.isUndefined(b)) {
|
|
2827
2925
|
return getMergedValue(a, b, prop, caseless);
|
|
@@ -3024,7 +3122,7 @@
|
|
|
3024
3122
|
if (!request) {
|
|
3025
3123
|
return;
|
|
3026
3124
|
}
|
|
3027
|
-
reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
|
|
3125
|
+
reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
|
|
3028
3126
|
|
|
3029
3127
|
// Clean up request
|
|
3030
3128
|
request = null;
|
|
@@ -3036,7 +3134,7 @@
|
|
|
3036
3134
|
// (message may be empty; when present, surface it)
|
|
3037
3135
|
// See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
|
|
3038
3136
|
var msg = event && event.message ? event.message : 'Network Error';
|
|
3039
|
-
var err = new AxiosError(msg, AxiosError.ERR_NETWORK, config, request);
|
|
3137
|
+
var err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
|
|
3040
3138
|
// attach the underlying event for consumers who want details
|
|
3041
3139
|
err.event = event || null;
|
|
3042
3140
|
reject(err);
|
|
@@ -3050,7 +3148,7 @@
|
|
|
3050
3148
|
if (_config.timeoutErrorMessage) {
|
|
3051
3149
|
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
3052
3150
|
}
|
|
3053
|
-
reject(new AxiosError(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, config, request));
|
|
3151
|
+
reject(new AxiosError$1(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED, config, request));
|
|
3054
3152
|
|
|
3055
3153
|
// Clean up request
|
|
3056
3154
|
request = null;
|
|
@@ -3101,7 +3199,7 @@
|
|
|
3101
3199
|
if (!request) {
|
|
3102
3200
|
return;
|
|
3103
3201
|
}
|
|
3104
|
-
reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
|
|
3202
|
+
reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
|
|
3105
3203
|
request.abort();
|
|
3106
3204
|
request = null;
|
|
3107
3205
|
};
|
|
@@ -3112,7 +3210,7 @@
|
|
|
3112
3210
|
}
|
|
3113
3211
|
var protocol = parseProtocol(_config.url);
|
|
3114
3212
|
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
3115
|
-
reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
|
|
3213
|
+
reject(new AxiosError$1('Unsupported protocol ' + protocol + ':', AxiosError$1.ERR_BAD_REQUEST, config));
|
|
3116
3214
|
return;
|
|
3117
3215
|
}
|
|
3118
3216
|
|
|
@@ -3132,12 +3230,12 @@
|
|
|
3132
3230
|
aborted = true;
|
|
3133
3231
|
unsubscribe();
|
|
3134
3232
|
var err = reason instanceof Error ? reason : this.reason;
|
|
3135
|
-
controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
|
|
3233
|
+
controller.abort(err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err));
|
|
3136
3234
|
}
|
|
3137
3235
|
};
|
|
3138
3236
|
var timer = timeout && setTimeout(function () {
|
|
3139
3237
|
timer = null;
|
|
3140
|
-
onabort(new AxiosError("timeout ".concat(timeout, "
|
|
3238
|
+
onabort(new AxiosError$1("timeout of ".concat(timeout, "ms exceeded"), AxiosError$1.ETIMEDOUT));
|
|
3141
3239
|
}, timeout);
|
|
3142
3240
|
var unsubscribe = function unsubscribe() {
|
|
3143
3241
|
if (signals) {
|
|
@@ -3458,7 +3556,7 @@
|
|
|
3458
3556
|
if (method) {
|
|
3459
3557
|
return method.call(res);
|
|
3460
3558
|
}
|
|
3461
|
-
throw new AxiosError("Response type '".concat(type, "' is not supported"), AxiosError.ERR_NOT_SUPPORT, config);
|
|
3559
|
+
throw new AxiosError$1("Response type '".concat(type, "' is not supported"), AxiosError$1.ERR_NOT_SUPPORT, config);
|
|
3462
3560
|
});
|
|
3463
3561
|
});
|
|
3464
3562
|
}();
|
|
@@ -3641,11 +3739,11 @@
|
|
|
3641
3739
|
_context4.next = 41;
|
|
3642
3740
|
break;
|
|
3643
3741
|
}
|
|
3644
|
-
throw Object.assign(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request), {
|
|
3742
|
+
throw Object.assign(new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request), {
|
|
3645
3743
|
cause: _context4.t2.cause || _context4.t2
|
|
3646
3744
|
});
|
|
3647
3745
|
case 41:
|
|
3648
|
-
throw AxiosError.from(_context4.t2, _context4.t2 && _context4.t2.code, config, request);
|
|
3746
|
+
throw AxiosError$1.from(_context4.t2, _context4.t2 && _context4.t2.code, config, request);
|
|
3649
3747
|
case 42:
|
|
3650
3748
|
case "end":
|
|
3651
3749
|
return _context4.stop();
|
|
@@ -3756,7 +3854,7 @@
|
|
|
3756
3854
|
if (!isResolvedHandle(nameOrAdapter)) {
|
|
3757
3855
|
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
3758
3856
|
if (adapter === undefined) {
|
|
3759
|
-
throw new AxiosError("Unknown adapter '".concat(id, "'"));
|
|
3857
|
+
throw new AxiosError$1("Unknown adapter '".concat(id, "'"));
|
|
3760
3858
|
}
|
|
3761
3859
|
}
|
|
3762
3860
|
if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
|
|
@@ -3772,7 +3870,7 @@
|
|
|
3772
3870
|
return "adapter ".concat(id, " ") + (state === false ? 'is not supported by the environment' : 'is not available in the build');
|
|
3773
3871
|
});
|
|
3774
3872
|
var s = length ? reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0]) : 'as no adapter specified';
|
|
3775
|
-
throw new AxiosError("There is no suitable adapter to dispatch the request " + s, 'ERR_NOT_SUPPORT');
|
|
3873
|
+
throw new AxiosError$1("There is no suitable adapter to dispatch the request " + s, 'ERR_NOT_SUPPORT');
|
|
3776
3874
|
}
|
|
3777
3875
|
return adapter;
|
|
3778
3876
|
}
|
|
@@ -3805,7 +3903,7 @@
|
|
|
3805
3903
|
config.cancelToken.throwIfRequested();
|
|
3806
3904
|
}
|
|
3807
3905
|
if (config.signal && config.signal.aborted) {
|
|
3808
|
-
throw new CanceledError(null, config);
|
|
3906
|
+
throw new CanceledError$1(null, config);
|
|
3809
3907
|
}
|
|
3810
3908
|
}
|
|
3811
3909
|
|
|
@@ -3847,7 +3945,7 @@
|
|
|
3847
3945
|
});
|
|
3848
3946
|
}
|
|
3849
3947
|
|
|
3850
|
-
var VERSION = "1.13.
|
|
3948
|
+
var VERSION = "1.13.3";
|
|
3851
3949
|
|
|
3852
3950
|
var validators$1 = {};
|
|
3853
3951
|
|
|
@@ -3876,7 +3974,7 @@
|
|
|
3876
3974
|
// eslint-disable-next-line func-names
|
|
3877
3975
|
return function (value, opt, opts) {
|
|
3878
3976
|
if (validator === false) {
|
|
3879
|
-
throw new AxiosError(formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), AxiosError.ERR_DEPRECATED);
|
|
3977
|
+
throw new AxiosError$1(formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), AxiosError$1.ERR_DEPRECATED);
|
|
3880
3978
|
}
|
|
3881
3979
|
if (version && !deprecatedWarnings[opt]) {
|
|
3882
3980
|
deprecatedWarnings[opt] = true;
|
|
@@ -3906,7 +4004,7 @@
|
|
|
3906
4004
|
|
|
3907
4005
|
function assertOptions(options, schema, allowUnknown) {
|
|
3908
4006
|
if (_typeof(options) !== 'object') {
|
|
3909
|
-
throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
|
|
4007
|
+
throw new AxiosError$1('options must be an object', AxiosError$1.ERR_BAD_OPTION_VALUE);
|
|
3910
4008
|
}
|
|
3911
4009
|
var keys = Object.keys(options);
|
|
3912
4010
|
var i = keys.length;
|
|
@@ -3917,12 +4015,12 @@
|
|
|
3917
4015
|
var value = options[opt];
|
|
3918
4016
|
var result = value === undefined || validator(value, opt, options);
|
|
3919
4017
|
if (result !== true) {
|
|
3920
|
-
throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
|
|
4018
|
+
throw new AxiosError$1('option ' + opt + ' must be ' + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
|
|
3921
4019
|
}
|
|
3922
4020
|
continue;
|
|
3923
4021
|
}
|
|
3924
4022
|
if (allowUnknown !== true) {
|
|
3925
|
-
throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
|
|
4023
|
+
throw new AxiosError$1('Unknown option ' + opt, AxiosError$1.ERR_BAD_OPTION);
|
|
3926
4024
|
}
|
|
3927
4025
|
}
|
|
3928
4026
|
}
|
|
@@ -4083,8 +4181,13 @@
|
|
|
4083
4181
|
chain.push.apply(chain, responseInterceptorChain);
|
|
4084
4182
|
len = chain.length;
|
|
4085
4183
|
promise = Promise.resolve(config);
|
|
4184
|
+
var prevResult = config;
|
|
4086
4185
|
while (i < len) {
|
|
4087
|
-
promise = promise.then(chain[i++]
|
|
4186
|
+
promise = promise.then(chain[i++]).then(function (result) {
|
|
4187
|
+
prevResult = result !== undefined ? result : prevResult;
|
|
4188
|
+
})["catch"](chain[i++]).then(function () {
|
|
4189
|
+
return prevResult;
|
|
4190
|
+
});
|
|
4088
4191
|
}
|
|
4089
4192
|
return promise;
|
|
4090
4193
|
}
|
|
@@ -4108,7 +4211,7 @@
|
|
|
4108
4211
|
i = 0;
|
|
4109
4212
|
len = responseInterceptorChain.length;
|
|
4110
4213
|
while (i < len) {
|
|
4111
|
-
promise = promise.then(responseInterceptorChain[i++]
|
|
4214
|
+
promise = promise.then(responseInterceptorChain[i++])["catch"](responseInterceptorChain[i++]);
|
|
4112
4215
|
}
|
|
4113
4216
|
return promise;
|
|
4114
4217
|
}
|
|
@@ -4199,7 +4302,7 @@
|
|
|
4199
4302
|
// Cancellation has already been requested
|
|
4200
4303
|
return;
|
|
4201
4304
|
}
|
|
4202
|
-
token.reason = new CanceledError(message, config, request);
|
|
4305
|
+
token.reason = new CanceledError$1(message, config, request);
|
|
4203
4306
|
resolvePromise(token.reason);
|
|
4204
4307
|
});
|
|
4205
4308
|
}
|
|
@@ -4289,7 +4392,7 @@
|
|
|
4289
4392
|
*
|
|
4290
4393
|
* ```js
|
|
4291
4394
|
* function f(x, y, z) {}
|
|
4292
|
-
*
|
|
4395
|
+
* const args = [1, 2, 3];
|
|
4293
4396
|
* f.apply(null, args);
|
|
4294
4397
|
* ```
|
|
4295
4398
|
*
|
|
@@ -4434,14 +4537,14 @@
|
|
|
4434
4537
|
axios.Axios = Axios$1;
|
|
4435
4538
|
|
|
4436
4539
|
// Expose Cancel & CancelToken
|
|
4437
|
-
axios.CanceledError = CanceledError;
|
|
4540
|
+
axios.CanceledError = CanceledError$1;
|
|
4438
4541
|
axios.CancelToken = CancelToken$1;
|
|
4439
4542
|
axios.isCancel = isCancel;
|
|
4440
4543
|
axios.VERSION = VERSION;
|
|
4441
4544
|
axios.toFormData = toFormData;
|
|
4442
4545
|
|
|
4443
4546
|
// Expose AxiosError class
|
|
4444
|
-
axios.AxiosError = AxiosError;
|
|
4547
|
+
axios.AxiosError = AxiosError$1;
|
|
4445
4548
|
|
|
4446
4549
|
// alias for CanceledError for backward compatibility
|
|
4447
4550
|
axios.Cancel = axios.CanceledError;
|