axios 1.1.3 → 1.2.0-alpha.1
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.
Potentially problematic release.
This version of axios might be problematic. Click here for more details.
- package/CHANGELOG.md +123 -74
- package/{UPGRADE_GUIDE.md → MIGRATION_GUIDE.md} +1 -1
- package/README.md +55 -20
- package/dist/axios.js +356 -211
- package/dist/axios.js.map +1 -1
- package/dist/axios.min.js +1 -1
- package/dist/axios.min.js.map +1 -1
- package/dist/browser/axios.cjs +3010 -0
- package/dist/browser/axios.cjs.map +1 -0
- package/dist/esm/axios.js +296 -216
- package/dist/esm/axios.js.map +1 -1
- package/dist/esm/axios.min.js +1 -1
- package/dist/esm/axios.min.js.map +1 -1
- package/dist/node/axios.cjs +224 -166
- package/dist/node/axios.cjs.map +1 -1
- package/index.d.cts +490 -0
- package/index.d.ts +28 -10
- package/index.js +8 -3
- package/karma.conf.cjs +1 -1
- package/lib/adapters/http.js +2 -2
- package/lib/adapters/xhr.js +2 -1
- package/lib/axios.js +7 -3
- package/lib/core/Axios.js +10 -8
- package/lib/core/AxiosHeaders.js +82 -76
- package/lib/core/dispatchRequest.js +4 -0
- package/lib/core/mergeConfig.js +50 -46
- package/lib/defaults/index.js +1 -1
- package/lib/env/data.js +1 -1
- package/lib/utils.js +36 -8
- package/package.json +13 -6
- package/rollup.config.js +37 -10
- package/tsconfig.json +2 -7
- package/tslint.json +6 -1
package/dist/esm/axios.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
// Axios v1.1
|
1
|
+
// Axios v1.2.0-alpha.1 Copyright (c) 2022 Matt Zabriskie and contributors
|
2
2
|
function bind(fn, thisArg) {
|
3
3
|
return function wrap() {
|
4
4
|
return fn.apply(thisArg, arguments);
|
@@ -231,7 +231,7 @@ const trim = (str) => str.trim ?
|
|
231
231
|
* @param {Function} fn The callback to invoke for each item
|
232
232
|
*
|
233
233
|
* @param {Boolean} [allOwnKeys = false]
|
234
|
-
* @returns {
|
234
|
+
* @returns {any}
|
235
235
|
*/
|
236
236
|
function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
237
237
|
// Don't bother if no value provided
|
@@ -266,6 +266,24 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
266
266
|
}
|
267
267
|
}
|
268
268
|
|
269
|
+
function findKey(obj, key) {
|
270
|
+
key = key.toLowerCase();
|
271
|
+
const keys = Object.keys(obj);
|
272
|
+
let i = keys.length;
|
273
|
+
let _key;
|
274
|
+
while (i-- > 0) {
|
275
|
+
_key = keys[i];
|
276
|
+
if (key === _key.toLowerCase()) {
|
277
|
+
return _key;
|
278
|
+
}
|
279
|
+
}
|
280
|
+
return null;
|
281
|
+
}
|
282
|
+
|
283
|
+
const _global = typeof self === "undefined" ? typeof global === "undefined" ? undefined : global : self;
|
284
|
+
|
285
|
+
const isContextDefined = (context) => !isUndefined(context) && context !== _global;
|
286
|
+
|
269
287
|
/**
|
270
288
|
* Accepts varargs expecting each argument to be an object, then
|
271
289
|
* immutably merges the properties of each object and returns result.
|
@@ -285,16 +303,18 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
285
303
|
* @returns {Object} Result of all merge properties
|
286
304
|
*/
|
287
305
|
function merge(/* obj1, obj2, obj3, ... */) {
|
306
|
+
const {caseless} = isContextDefined(this) && this || {};
|
288
307
|
const result = {};
|
289
308
|
const assignValue = (val, key) => {
|
290
|
-
|
291
|
-
|
309
|
+
const targetKey = caseless && findKey(result, key) || key;
|
310
|
+
if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
|
311
|
+
result[targetKey] = merge(result[targetKey], val);
|
292
312
|
} else if (isPlainObject(val)) {
|
293
|
-
result[
|
313
|
+
result[targetKey] = merge({}, val);
|
294
314
|
} else if (isArray(val)) {
|
295
|
-
result[
|
315
|
+
result[targetKey] = val.slice();
|
296
316
|
} else {
|
297
|
-
result[
|
317
|
+
result[targetKey] = val;
|
298
318
|
}
|
299
319
|
};
|
300
320
|
|
@@ -530,6 +550,11 @@ const reduceDescriptors = (obj, reducer) => {
|
|
530
550
|
|
531
551
|
const freezeMethods = (obj) => {
|
532
552
|
reduceDescriptors(obj, (descriptor, name) => {
|
553
|
+
// skip restricted props in strict mode
|
554
|
+
if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
555
|
+
return false;
|
556
|
+
}
|
557
|
+
|
533
558
|
const value = obj[name];
|
534
559
|
|
535
560
|
if (!isFunction(value)) return;
|
@@ -543,7 +568,7 @@ const freezeMethods = (obj) => {
|
|
543
568
|
|
544
569
|
if (!descriptor.set) {
|
545
570
|
descriptor.set = () => {
|
546
|
-
throw Error('Can not read-only method \'' + name + '\'');
|
571
|
+
throw Error('Can not rewrite read-only method \'' + name + '\'');
|
547
572
|
};
|
548
573
|
}
|
549
574
|
});
|
@@ -612,7 +637,10 @@ const utils = {
|
|
612
637
|
toObjectSet,
|
613
638
|
toCamelCase,
|
614
639
|
noop,
|
615
|
-
toFiniteNumber
|
640
|
+
toFiniteNumber,
|
641
|
+
findKey,
|
642
|
+
global: _global,
|
643
|
+
isContextDefined
|
616
644
|
};
|
617
645
|
|
618
646
|
/**
|
@@ -626,7 +654,7 @@ const utils = {
|
|
626
654
|
*
|
627
655
|
* @returns {Error} The created error.
|
628
656
|
*/
|
629
|
-
function AxiosError(message, code, config, request, response) {
|
657
|
+
function AxiosError$1(message, code, config, request, response) {
|
630
658
|
Error.call(this);
|
631
659
|
|
632
660
|
if (Error.captureStackTrace) {
|
@@ -643,7 +671,7 @@ function AxiosError(message, code, config, request, response) {
|
|
643
671
|
response && (this.response = response);
|
644
672
|
}
|
645
673
|
|
646
|
-
utils.inherits(AxiosError, Error, {
|
674
|
+
utils.inherits(AxiosError$1, Error, {
|
647
675
|
toJSON: function toJSON() {
|
648
676
|
return {
|
649
677
|
// Standard
|
@@ -665,7 +693,7 @@ utils.inherits(AxiosError, Error, {
|
|
665
693
|
}
|
666
694
|
});
|
667
695
|
|
668
|
-
const prototype$1 = AxiosError.prototype;
|
696
|
+
const prototype$1 = AxiosError$1.prototype;
|
669
697
|
const descriptors = {};
|
670
698
|
|
671
699
|
[
|
@@ -686,11 +714,11 @@ const descriptors = {};
|
|
686
714
|
descriptors[code] = {value: code};
|
687
715
|
});
|
688
716
|
|
689
|
-
Object.defineProperties(AxiosError, descriptors);
|
717
|
+
Object.defineProperties(AxiosError$1, descriptors);
|
690
718
|
Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
|
691
719
|
|
692
720
|
// eslint-disable-next-line func-names
|
693
|
-
AxiosError.from = (error, code, config, request, response, customProps) => {
|
721
|
+
AxiosError$1.from = (error, code, config, request, response, customProps) => {
|
694
722
|
const axiosError = Object.create(prototype$1);
|
695
723
|
|
696
724
|
utils.toFlatObject(error, axiosError, function filter(obj) {
|
@@ -699,7 +727,7 @@ AxiosError.from = (error, code, config, request, response, customProps) => {
|
|
699
727
|
return prop !== 'isAxiosError';
|
700
728
|
});
|
701
729
|
|
702
|
-
AxiosError.call(axiosError, error.message, code, config, request, response);
|
730
|
+
AxiosError$1.call(axiosError, error.message, code, config, request, response);
|
703
731
|
|
704
732
|
axiosError.cause = error;
|
705
733
|
|
@@ -713,6 +741,8 @@ AxiosError.from = (error, code, config, request, response, customProps) => {
|
|
713
741
|
/* eslint-env browser */
|
714
742
|
var browser = typeof self == 'object' ? self.FormData : window.FormData;
|
715
743
|
|
744
|
+
const FormData$2 = browser;
|
745
|
+
|
716
746
|
/**
|
717
747
|
* Determines if the given thing is a array or js object.
|
718
748
|
*
|
@@ -802,13 +832,13 @@ function isSpecCompliant(thing) {
|
|
802
832
|
*
|
803
833
|
* @returns
|
804
834
|
*/
|
805
|
-
function toFormData(obj, formData, options) {
|
835
|
+
function toFormData$1(obj, formData, options) {
|
806
836
|
if (!utils.isObject(obj)) {
|
807
837
|
throw new TypeError('target must be an object');
|
808
838
|
}
|
809
839
|
|
810
840
|
// eslint-disable-next-line no-param-reassign
|
811
|
-
formData = formData || new (
|
841
|
+
formData = formData || new (FormData$2 || FormData)();
|
812
842
|
|
813
843
|
// eslint-disable-next-line no-param-reassign
|
814
844
|
options = utils.toFlatObject(options, {
|
@@ -840,7 +870,7 @@ function toFormData(obj, formData, options) {
|
|
840
870
|
}
|
841
871
|
|
842
872
|
if (!useBlob && utils.isBlob(value)) {
|
843
|
-
throw new AxiosError('Blob is not supported. Use a Buffer instead.');
|
873
|
+
throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
|
844
874
|
}
|
845
875
|
|
846
876
|
if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
|
@@ -969,7 +999,7 @@ function encode$1(str) {
|
|
969
999
|
function AxiosURLSearchParams(params, options) {
|
970
1000
|
this._pairs = [];
|
971
1001
|
|
972
|
-
params && toFormData(params, this, options);
|
1002
|
+
params && toFormData$1(params, this, options);
|
973
1003
|
}
|
974
1004
|
|
975
1005
|
const prototype = AxiosURLSearchParams.prototype;
|
@@ -1113,6 +1143,8 @@ class InterceptorManager {
|
|
1113
1143
|
}
|
1114
1144
|
}
|
1115
1145
|
|
1146
|
+
const InterceptorManager$1 = InterceptorManager;
|
1147
|
+
|
1116
1148
|
const transitionalDefaults = {
|
1117
1149
|
silentJSONParsing: true,
|
1118
1150
|
forcedJSONParsing: true,
|
@@ -1165,7 +1197,7 @@ const platform = {
|
|
1165
1197
|
};
|
1166
1198
|
|
1167
1199
|
function toURLEncodedForm(data, options) {
|
1168
|
-
return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
|
1200
|
+
return toFormData$1(data, new platform.classes.URLSearchParams(), Object.assign({
|
1169
1201
|
visitor: function(value, key, path, helpers) {
|
1170
1202
|
if (platform.isNode && utils.isBuffer(value)) {
|
1171
1203
|
this.append(key, value.toString('base64'));
|
@@ -1278,9 +1310,9 @@ function settle(resolve, reject, response) {
|
|
1278
1310
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
1279
1311
|
resolve(response);
|
1280
1312
|
} else {
|
1281
|
-
reject(new AxiosError(
|
1313
|
+
reject(new AxiosError$1(
|
1282
1314
|
'Request failed with status code ' + response.status,
|
1283
|
-
[AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
1315
|
+
[AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
1284
1316
|
response.config,
|
1285
1317
|
response.request,
|
1286
1318
|
response
|
@@ -1453,13 +1485,13 @@ const isURLSameOrigin = platform.isStandardBrowserEnv ?
|
|
1453
1485
|
*
|
1454
1486
|
* @returns {CanceledError} The created error.
|
1455
1487
|
*/
|
1456
|
-
function CanceledError(message, config, request) {
|
1488
|
+
function CanceledError$1(message, config, request) {
|
1457
1489
|
// eslint-disable-next-line no-eq-null,eqeqeq
|
1458
|
-
AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
|
1490
|
+
AxiosError$1.call(this, message == null ? 'canceled' : message, AxiosError$1.ERR_CANCELED, config, request);
|
1459
1491
|
this.name = 'CanceledError';
|
1460
1492
|
}
|
1461
1493
|
|
1462
|
-
utils.inherits(CanceledError, AxiosError, {
|
1494
|
+
utils.inherits(CanceledError$1, AxiosError$1, {
|
1463
1495
|
__CANCEL__: true
|
1464
1496
|
});
|
1465
1497
|
|
@@ -1521,7 +1553,6 @@ const parseHeaders = rawHeaders => {
|
|
1521
1553
|
};
|
1522
1554
|
|
1523
1555
|
const $internals = Symbol('internals');
|
1524
|
-
const $defaults = Symbol('defaults');
|
1525
1556
|
|
1526
1557
|
function normalizeHeader(header) {
|
1527
1558
|
return header && String(header).trim().toLowerCase();
|
@@ -1547,6 +1578,10 @@ function parseTokens(str) {
|
|
1547
1578
|
return tokens;
|
1548
1579
|
}
|
1549
1580
|
|
1581
|
+
function isValidHeaderName(str) {
|
1582
|
+
return /^[-_a-zA-Z]+$/.test(str.trim());
|
1583
|
+
}
|
1584
|
+
|
1550
1585
|
function matchHeaderValue(context, value, header, filter) {
|
1551
1586
|
if (utils.isFunction(filter)) {
|
1552
1587
|
return filter.call(this, value, header);
|
@@ -1583,27 +1618,12 @@ function buildAccessors(obj, header) {
|
|
1583
1618
|
});
|
1584
1619
|
}
|
1585
1620
|
|
1586
|
-
|
1587
|
-
|
1588
|
-
|
1589
|
-
let i = keys.length;
|
1590
|
-
let _key;
|
1591
|
-
while (i-- > 0) {
|
1592
|
-
_key = keys[i];
|
1593
|
-
if (key === _key.toLowerCase()) {
|
1594
|
-
return _key;
|
1595
|
-
}
|
1621
|
+
class AxiosHeaders$1 {
|
1622
|
+
constructor(headers) {
|
1623
|
+
headers && this.set(headers);
|
1596
1624
|
}
|
1597
|
-
return null;
|
1598
|
-
}
|
1599
|
-
|
1600
|
-
function AxiosHeaders(headers, defaults) {
|
1601
|
-
headers && this.set(headers);
|
1602
|
-
this[$defaults] = defaults || null;
|
1603
|
-
}
|
1604
1625
|
|
1605
|
-
|
1606
|
-
set: function(header, valueOrRewrite, rewrite) {
|
1626
|
+
set(header, valueOrRewrite, rewrite) {
|
1607
1627
|
const self = this;
|
1608
1628
|
|
1609
1629
|
function setHeader(_value, _header, _rewrite) {
|
@@ -1613,69 +1633,70 @@ Object.assign(AxiosHeaders.prototype, {
|
|
1613
1633
|
throw new Error('header name must be a non-empty string');
|
1614
1634
|
}
|
1615
1635
|
|
1616
|
-
const key = findKey(self, lHeader);
|
1636
|
+
const key = utils.findKey(self, lHeader);
|
1617
1637
|
|
1618
|
-
if
|
1619
|
-
|
1638
|
+
if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
|
1639
|
+
self[key || _header] = normalizeValue(_value);
|
1620
1640
|
}
|
1621
|
-
|
1622
|
-
self[key || _header] = normalizeValue(_value);
|
1623
1641
|
}
|
1624
1642
|
|
1625
|
-
|
1626
|
-
utils.forEach(
|
1627
|
-
|
1628
|
-
|
1643
|
+
const setHeaders = (headers, _rewrite) =>
|
1644
|
+
utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
1645
|
+
|
1646
|
+
if (utils.isPlainObject(header) || header instanceof this.constructor) {
|
1647
|
+
setHeaders(header, valueOrRewrite);
|
1648
|
+
} else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
1649
|
+
setHeaders(parseHeaders(header), valueOrRewrite);
|
1629
1650
|
} else {
|
1630
|
-
setHeader(valueOrRewrite, header, rewrite);
|
1651
|
+
header != null && setHeader(valueOrRewrite, header, rewrite);
|
1631
1652
|
}
|
1632
1653
|
|
1633
1654
|
return this;
|
1634
|
-
}
|
1655
|
+
}
|
1635
1656
|
|
1636
|
-
get
|
1657
|
+
get(header, parser) {
|
1637
1658
|
header = normalizeHeader(header);
|
1638
1659
|
|
1639
|
-
if (
|
1660
|
+
if (header) {
|
1661
|
+
const key = utils.findKey(this, header);
|
1640
1662
|
|
1641
|
-
|
1663
|
+
if (key) {
|
1664
|
+
const value = this[key];
|
1642
1665
|
|
1643
|
-
|
1644
|
-
|
1666
|
+
if (!parser) {
|
1667
|
+
return value;
|
1668
|
+
}
|
1645
1669
|
|
1646
|
-
|
1647
|
-
|
1648
|
-
|
1670
|
+
if (parser === true) {
|
1671
|
+
return parseTokens(value);
|
1672
|
+
}
|
1649
1673
|
|
1650
|
-
|
1651
|
-
|
1652
|
-
|
1674
|
+
if (utils.isFunction(parser)) {
|
1675
|
+
return parser.call(this, value, key);
|
1676
|
+
}
|
1653
1677
|
|
1654
|
-
|
1655
|
-
|
1656
|
-
|
1678
|
+
if (utils.isRegExp(parser)) {
|
1679
|
+
return parser.exec(value);
|
1680
|
+
}
|
1657
1681
|
|
1658
|
-
|
1659
|
-
return parser.exec(value);
|
1682
|
+
throw new TypeError('parser must be boolean|regexp|function');
|
1660
1683
|
}
|
1661
|
-
|
1662
|
-
throw new TypeError('parser must be boolean|regexp|function');
|
1663
1684
|
}
|
1664
|
-
}
|
1685
|
+
}
|
1665
1686
|
|
1666
|
-
has
|
1687
|
+
has(header, matcher) {
|
1667
1688
|
header = normalizeHeader(header);
|
1668
1689
|
|
1669
1690
|
if (header) {
|
1670
|
-
const key = findKey(this, header);
|
1691
|
+
const key = utils.findKey(this, header);
|
1671
1692
|
|
1672
1693
|
return !!(key && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
1673
1694
|
}
|
1674
1695
|
|
1675
1696
|
return false;
|
1676
|
-
}
|
1697
|
+
}
|
1677
1698
|
|
1678
|
-
delete
|
1699
|
+
delete(header, matcher) {
|
1679
1700
|
const self = this;
|
1680
1701
|
let deleted = false;
|
1681
1702
|
|
@@ -1683,7 +1704,7 @@ Object.assign(AxiosHeaders.prototype, {
|
|
1683
1704
|
_header = normalizeHeader(_header);
|
1684
1705
|
|
1685
1706
|
if (_header) {
|
1686
|
-
const key = findKey(self, _header);
|
1707
|
+
const key = utils.findKey(self, _header);
|
1687
1708
|
|
1688
1709
|
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
|
1689
1710
|
delete self[key];
|
@@ -1700,18 +1721,18 @@ Object.assign(AxiosHeaders.prototype, {
|
|
1700
1721
|
}
|
1701
1722
|
|
1702
1723
|
return deleted;
|
1703
|
-
}
|
1724
|
+
}
|
1704
1725
|
|
1705
|
-
clear
|
1726
|
+
clear() {
|
1706
1727
|
return Object.keys(this).forEach(this.delete.bind(this));
|
1707
|
-
}
|
1728
|
+
}
|
1708
1729
|
|
1709
|
-
normalize
|
1730
|
+
normalize(format) {
|
1710
1731
|
const self = this;
|
1711
1732
|
const headers = {};
|
1712
1733
|
|
1713
1734
|
utils.forEach(this, (value, header) => {
|
1714
|
-
const key = findKey(headers, header);
|
1735
|
+
const key = utils.findKey(headers, header);
|
1715
1736
|
|
1716
1737
|
if (key) {
|
1717
1738
|
self[key] = normalizeValue(value);
|
@@ -1731,30 +1752,47 @@ Object.assign(AxiosHeaders.prototype, {
|
|
1731
1752
|
});
|
1732
1753
|
|
1733
1754
|
return this;
|
1734
|
-
}
|
1755
|
+
}
|
1756
|
+
|
1757
|
+
concat(...targets) {
|
1758
|
+
return this.constructor.concat(this, ...targets);
|
1759
|
+
}
|
1735
1760
|
|
1736
|
-
toJSON
|
1761
|
+
toJSON(asStrings) {
|
1737
1762
|
const obj = Object.create(null);
|
1738
1763
|
|
1739
|
-
utils.forEach(
|
1740
|
-
(value,
|
1741
|
-
|
1742
|
-
obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value;
|
1743
|
-
});
|
1764
|
+
utils.forEach(this, (value, header) => {
|
1765
|
+
value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);
|
1766
|
+
});
|
1744
1767
|
|
1745
1768
|
return obj;
|
1746
1769
|
}
|
1747
|
-
});
|
1748
1770
|
|
1749
|
-
|
1750
|
-
|
1751
|
-
|
1752
|
-
|
1753
|
-
|
1771
|
+
[Symbol.iterator]() {
|
1772
|
+
return Object.entries(this.toJSON())[Symbol.iterator]();
|
1773
|
+
}
|
1774
|
+
|
1775
|
+
toString() {
|
1776
|
+
return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
|
1777
|
+
}
|
1778
|
+
|
1779
|
+
get [Symbol.toStringTag]() {
|
1780
|
+
return 'AxiosHeaders';
|
1781
|
+
}
|
1782
|
+
|
1783
|
+
static from(thing) {
|
1754
1784
|
return thing instanceof this ? thing : new this(thing);
|
1755
|
-
}
|
1785
|
+
}
|
1786
|
+
|
1787
|
+
static concat(first, ...targets) {
|
1788
|
+
const computed = new this(first);
|
1789
|
+
|
1790
|
+
targets.forEach((target) => computed.set(target));
|
1756
1791
|
|
1757
|
-
|
1792
|
+
return computed;
|
1793
|
+
}
|
1794
|
+
|
1795
|
+
static accessor(header) {
|
1758
1796
|
const internals = this[$internals] = (this[$internals] = {
|
1759
1797
|
accessors: {}
|
1760
1798
|
});
|
@@ -1775,12 +1813,14 @@ Object.assign(AxiosHeaders, {
|
|
1775
1813
|
|
1776
1814
|
return this;
|
1777
1815
|
}
|
1778
|
-
}
|
1816
|
+
}
|
1817
|
+
|
1818
|
+
AxiosHeaders$1.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent']);
|
1779
1819
|
|
1780
|
-
AxiosHeaders.
|
1820
|
+
utils.freezeMethods(AxiosHeaders$1.prototype);
|
1821
|
+
utils.freezeMethods(AxiosHeaders$1);
|
1781
1822
|
|
1782
|
-
|
1783
|
-
utils.freezeMethods(AxiosHeaders);
|
1823
|
+
const AxiosHeaders$2 = AxiosHeaders$1;
|
1784
1824
|
|
1785
1825
|
/**
|
1786
1826
|
* Calculate data maxRate
|
@@ -1853,7 +1893,8 @@ function progressEventReducer(listener, isDownloadStream) {
|
|
1853
1893
|
progress: total ? (loaded / total) : undefined,
|
1854
1894
|
bytes: progressBytes,
|
1855
1895
|
rate: rate ? rate : undefined,
|
1856
|
-
estimated: rate && total && inRange ? (total - loaded) / rate : undefined
|
1896
|
+
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
1897
|
+
event: e
|
1857
1898
|
};
|
1858
1899
|
|
1859
1900
|
data[isDownloadStream ? 'download' : 'upload'] = true;
|
@@ -1865,7 +1906,7 @@ function progressEventReducer(listener, isDownloadStream) {
|
|
1865
1906
|
function xhrAdapter(config) {
|
1866
1907
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
1867
1908
|
let requestData = config.data;
|
1868
|
-
const requestHeaders = AxiosHeaders.from(config.headers).normalize();
|
1909
|
+
const requestHeaders = AxiosHeaders$2.from(config.headers).normalize();
|
1869
1910
|
const responseType = config.responseType;
|
1870
1911
|
let onCanceled;
|
1871
1912
|
function done() {
|
@@ -1903,7 +1944,7 @@ function xhrAdapter(config) {
|
|
1903
1944
|
return;
|
1904
1945
|
}
|
1905
1946
|
// Prepare the response
|
1906
|
-
const responseHeaders = AxiosHeaders.from(
|
1947
|
+
const responseHeaders = AxiosHeaders$2.from(
|
1907
1948
|
'getAllResponseHeaders' in request && request.getAllResponseHeaders()
|
1908
1949
|
);
|
1909
1950
|
const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
|
@@ -1958,7 +1999,7 @@ function xhrAdapter(config) {
|
|
1958
1999
|
return;
|
1959
2000
|
}
|
1960
2001
|
|
1961
|
-
reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
|
2002
|
+
reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
|
1962
2003
|
|
1963
2004
|
// Clean up request
|
1964
2005
|
request = null;
|
@@ -1968,7 +2009,7 @@ function xhrAdapter(config) {
|
|
1968
2009
|
request.onerror = function handleError() {
|
1969
2010
|
// Real errors are hidden from us by the browser
|
1970
2011
|
// onerror should only fire if it's a network error
|
1971
|
-
reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
|
2012
|
+
reject(new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request));
|
1972
2013
|
|
1973
2014
|
// Clean up request
|
1974
2015
|
request = null;
|
@@ -1981,9 +2022,9 @@ function xhrAdapter(config) {
|
|
1981
2022
|
if (config.timeoutErrorMessage) {
|
1982
2023
|
timeoutErrorMessage = config.timeoutErrorMessage;
|
1983
2024
|
}
|
1984
|
-
reject(new AxiosError(
|
2025
|
+
reject(new AxiosError$1(
|
1985
2026
|
timeoutErrorMessage,
|
1986
|
-
transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
|
2027
|
+
transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
|
1987
2028
|
config,
|
1988
2029
|
request));
|
1989
2030
|
|
@@ -2041,7 +2082,7 @@ function xhrAdapter(config) {
|
|
2041
2082
|
if (!request) {
|
2042
2083
|
return;
|
2043
2084
|
}
|
2044
|
-
reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
|
2085
|
+
reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
|
2045
2086
|
request.abort();
|
2046
2087
|
request = null;
|
2047
2088
|
};
|
@@ -2055,7 +2096,7 @@ function xhrAdapter(config) {
|
|
2055
2096
|
const protocol = parseProtocol(fullPath);
|
2056
2097
|
|
2057
2098
|
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
2058
|
-
reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
|
2099
|
+
reject(new AxiosError$1('Unsupported protocol ' + protocol + ':', AxiosError$1.ERR_BAD_REQUEST, config));
|
2059
2100
|
return;
|
2060
2101
|
}
|
2061
2102
|
|
@@ -2096,7 +2137,7 @@ const adapters$1 = {
|
|
2096
2137
|
};
|
2097
2138
|
|
2098
2139
|
const DEFAULT_CONTENT_TYPE = {
|
2099
|
-
'Content-Type':
|
2140
|
+
'Content-Type': undefined
|
2100
2141
|
};
|
2101
2142
|
|
2102
2143
|
/**
|
@@ -2192,7 +2233,7 @@ const defaults = {
|
|
2192
2233
|
if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
|
2193
2234
|
const _FormData = this.env && this.env.FormData;
|
2194
2235
|
|
2195
|
-
return toFormData(
|
2236
|
+
return toFormData$1(
|
2196
2237
|
isFileList ? {'files[]': data} : data,
|
2197
2238
|
_FormData && new _FormData(),
|
2198
2239
|
this.formSerializer
|
@@ -2222,7 +2263,7 @@ const defaults = {
|
|
2222
2263
|
} catch (e) {
|
2223
2264
|
if (strictJSONParsing) {
|
2224
2265
|
if (e.name === 'SyntaxError') {
|
2225
|
-
throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
|
2266
|
+
throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
|
2226
2267
|
}
|
2227
2268
|
throw e;
|
2228
2269
|
}
|
@@ -2268,6 +2309,8 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
2268
2309
|
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
|
2269
2310
|
});
|
2270
2311
|
|
2312
|
+
const defaults$1 = defaults;
|
2313
|
+
|
2271
2314
|
/**
|
2272
2315
|
* Transform the data for a request or a response
|
2273
2316
|
*
|
@@ -2277,9 +2320,9 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
2277
2320
|
* @returns {*} The resulting transformed data
|
2278
2321
|
*/
|
2279
2322
|
function transformData(fns, response) {
|
2280
|
-
const config = this || defaults;
|
2323
|
+
const config = this || defaults$1;
|
2281
2324
|
const context = response || config;
|
2282
|
-
const headers = AxiosHeaders.from(context.headers);
|
2325
|
+
const headers = AxiosHeaders$2.from(context.headers);
|
2283
2326
|
let data = context.data;
|
2284
2327
|
|
2285
2328
|
utils.forEach(fns, function transform(fn) {
|
@@ -2291,7 +2334,7 @@ function transformData(fns, response) {
|
|
2291
2334
|
return data;
|
2292
2335
|
}
|
2293
2336
|
|
2294
|
-
function isCancel(value) {
|
2337
|
+
function isCancel$1(value) {
|
2295
2338
|
return !!(value && value.__CANCEL__);
|
2296
2339
|
}
|
2297
2340
|
|
@@ -2308,7 +2351,7 @@ function throwIfCancellationRequested(config) {
|
|
2308
2351
|
}
|
2309
2352
|
|
2310
2353
|
if (config.signal && config.signal.aborted) {
|
2311
|
-
throw new CanceledError();
|
2354
|
+
throw new CanceledError$1();
|
2312
2355
|
}
|
2313
2356
|
}
|
2314
2357
|
|
@@ -2322,7 +2365,7 @@ function throwIfCancellationRequested(config) {
|
|
2322
2365
|
function dispatchRequest(config) {
|
2323
2366
|
throwIfCancellationRequested(config);
|
2324
2367
|
|
2325
|
-
config.headers = AxiosHeaders.from(config.headers);
|
2368
|
+
config.headers = AxiosHeaders$2.from(config.headers);
|
2326
2369
|
|
2327
2370
|
// Transform request data
|
2328
2371
|
config.data = transformData.call(
|
@@ -2330,7 +2373,11 @@ function dispatchRequest(config) {
|
|
2330
2373
|
config.transformRequest
|
2331
2374
|
);
|
2332
2375
|
|
2333
|
-
|
2376
|
+
if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
|
2377
|
+
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
2378
|
+
}
|
2379
|
+
|
2380
|
+
const adapter = config.adapter || defaults$1.adapter;
|
2334
2381
|
|
2335
2382
|
return adapter(config).then(function onAdapterResolution(response) {
|
2336
2383
|
throwIfCancellationRequested(config);
|
@@ -2342,11 +2389,11 @@ function dispatchRequest(config) {
|
|
2342
2389
|
response
|
2343
2390
|
);
|
2344
2391
|
|
2345
|
-
response.headers = AxiosHeaders.from(response.headers);
|
2392
|
+
response.headers = AxiosHeaders$2.from(response.headers);
|
2346
2393
|
|
2347
2394
|
return response;
|
2348
2395
|
}, function onAdapterRejection(reason) {
|
2349
|
-
if (!isCancel(reason)) {
|
2396
|
+
if (!isCancel$1(reason)) {
|
2350
2397
|
throwIfCancellationRequested(config);
|
2351
2398
|
|
2352
2399
|
// Transform response data
|
@@ -2356,7 +2403,7 @@ function dispatchRequest(config) {
|
|
2356
2403
|
config.transformResponse,
|
2357
2404
|
reason.response
|
2358
2405
|
);
|
2359
|
-
reason.response.headers = AxiosHeaders.from(reason.response.headers);
|
2406
|
+
reason.response.headers = AxiosHeaders$2.from(reason.response.headers);
|
2360
2407
|
}
|
2361
2408
|
}
|
2362
2409
|
|
@@ -2364,6 +2411,8 @@ function dispatchRequest(config) {
|
|
2364
2411
|
});
|
2365
2412
|
}
|
2366
2413
|
|
2414
|
+
const headersToObject = (thing) => thing instanceof AxiosHeaders$2 ? thing.toJSON() : thing;
|
2415
|
+
|
2367
2416
|
/**
|
2368
2417
|
* Config-specific merge-function which creates a new config-object
|
2369
2418
|
* by merging two configuration objects together.
|
@@ -2378,9 +2427,9 @@ function mergeConfig(config1, config2) {
|
|
2378
2427
|
config2 = config2 || {};
|
2379
2428
|
const config = {};
|
2380
2429
|
|
2381
|
-
function getMergedValue(target, source) {
|
2430
|
+
function getMergedValue(target, source, caseless) {
|
2382
2431
|
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
2383
|
-
return utils.merge(target, source);
|
2432
|
+
return utils.merge.call({caseless}, target, source);
|
2384
2433
|
} else if (utils.isPlainObject(source)) {
|
2385
2434
|
return utils.merge({}, source);
|
2386
2435
|
} else if (utils.isArray(source)) {
|
@@ -2390,79 +2439,80 @@ function mergeConfig(config1, config2) {
|
|
2390
2439
|
}
|
2391
2440
|
|
2392
2441
|
// eslint-disable-next-line consistent-return
|
2393
|
-
function mergeDeepProperties(
|
2394
|
-
if (!utils.isUndefined(
|
2395
|
-
return getMergedValue(
|
2396
|
-
} else if (!utils.isUndefined(
|
2397
|
-
return getMergedValue(undefined,
|
2442
|
+
function mergeDeepProperties(a, b, caseless) {
|
2443
|
+
if (!utils.isUndefined(b)) {
|
2444
|
+
return getMergedValue(a, b, caseless);
|
2445
|
+
} else if (!utils.isUndefined(a)) {
|
2446
|
+
return getMergedValue(undefined, a, caseless);
|
2398
2447
|
}
|
2399
2448
|
}
|
2400
2449
|
|
2401
2450
|
// eslint-disable-next-line consistent-return
|
2402
|
-
function valueFromConfig2(
|
2403
|
-
if (!utils.isUndefined(
|
2404
|
-
return getMergedValue(undefined,
|
2451
|
+
function valueFromConfig2(a, b) {
|
2452
|
+
if (!utils.isUndefined(b)) {
|
2453
|
+
return getMergedValue(undefined, b);
|
2405
2454
|
}
|
2406
2455
|
}
|
2407
2456
|
|
2408
2457
|
// eslint-disable-next-line consistent-return
|
2409
|
-
function defaultToConfig2(
|
2410
|
-
if (!utils.isUndefined(
|
2411
|
-
return getMergedValue(undefined,
|
2412
|
-
} else if (!utils.isUndefined(
|
2413
|
-
return getMergedValue(undefined,
|
2458
|
+
function defaultToConfig2(a, b) {
|
2459
|
+
if (!utils.isUndefined(b)) {
|
2460
|
+
return getMergedValue(undefined, b);
|
2461
|
+
} else if (!utils.isUndefined(a)) {
|
2462
|
+
return getMergedValue(undefined, a);
|
2414
2463
|
}
|
2415
2464
|
}
|
2416
2465
|
|
2417
2466
|
// eslint-disable-next-line consistent-return
|
2418
|
-
function mergeDirectKeys(prop) {
|
2467
|
+
function mergeDirectKeys(a, b, prop) {
|
2419
2468
|
if (prop in config2) {
|
2420
|
-
return getMergedValue(
|
2469
|
+
return getMergedValue(a, b);
|
2421
2470
|
} else if (prop in config1) {
|
2422
|
-
return getMergedValue(undefined,
|
2471
|
+
return getMergedValue(undefined, a);
|
2423
2472
|
}
|
2424
2473
|
}
|
2425
2474
|
|
2426
2475
|
const mergeMap = {
|
2427
|
-
|
2428
|
-
|
2429
|
-
|
2430
|
-
|
2431
|
-
|
2432
|
-
|
2433
|
-
|
2434
|
-
|
2435
|
-
|
2436
|
-
|
2437
|
-
|
2438
|
-
|
2439
|
-
|
2440
|
-
|
2441
|
-
|
2442
|
-
|
2443
|
-
|
2444
|
-
|
2445
|
-
|
2446
|
-
|
2447
|
-
|
2448
|
-
|
2449
|
-
|
2450
|
-
|
2451
|
-
|
2452
|
-
|
2453
|
-
|
2476
|
+
url: valueFromConfig2,
|
2477
|
+
method: valueFromConfig2,
|
2478
|
+
data: valueFromConfig2,
|
2479
|
+
baseURL: defaultToConfig2,
|
2480
|
+
transformRequest: defaultToConfig2,
|
2481
|
+
transformResponse: defaultToConfig2,
|
2482
|
+
paramsSerializer: defaultToConfig2,
|
2483
|
+
timeout: defaultToConfig2,
|
2484
|
+
timeoutMessage: defaultToConfig2,
|
2485
|
+
withCredentials: defaultToConfig2,
|
2486
|
+
adapter: defaultToConfig2,
|
2487
|
+
responseType: defaultToConfig2,
|
2488
|
+
xsrfCookieName: defaultToConfig2,
|
2489
|
+
xsrfHeaderName: defaultToConfig2,
|
2490
|
+
onUploadProgress: defaultToConfig2,
|
2491
|
+
onDownloadProgress: defaultToConfig2,
|
2492
|
+
decompress: defaultToConfig2,
|
2493
|
+
maxContentLength: defaultToConfig2,
|
2494
|
+
maxBodyLength: defaultToConfig2,
|
2495
|
+
beforeRedirect: defaultToConfig2,
|
2496
|
+
transport: defaultToConfig2,
|
2497
|
+
httpAgent: defaultToConfig2,
|
2498
|
+
httpsAgent: defaultToConfig2,
|
2499
|
+
cancelToken: defaultToConfig2,
|
2500
|
+
socketPath: defaultToConfig2,
|
2501
|
+
responseEncoding: defaultToConfig2,
|
2502
|
+
validateStatus: mergeDirectKeys,
|
2503
|
+
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
|
2454
2504
|
};
|
2455
2505
|
|
2456
2506
|
utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
|
2457
2507
|
const merge = mergeMap[prop] || mergeDeepProperties;
|
2458
|
-
const configValue = merge(prop);
|
2508
|
+
const configValue = merge(config1[prop], config2[prop], prop);
|
2459
2509
|
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
2460
2510
|
});
|
2461
2511
|
|
2462
2512
|
return config;
|
2463
2513
|
}
|
2464
2514
|
|
2465
|
-
const VERSION = "1.1
|
2515
|
+
const VERSION$1 = "1.2.0-alpha.1";
|
2466
2516
|
|
2467
2517
|
const validators$1 = {};
|
2468
2518
|
|
@@ -2486,15 +2536,15 @@ const deprecatedWarnings = {};
|
|
2486
2536
|
*/
|
2487
2537
|
validators$1.transitional = function transitional(validator, version, message) {
|
2488
2538
|
function formatMessage(opt, desc) {
|
2489
|
-
return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
|
2539
|
+
return '[Axios v' + VERSION$1 + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
|
2490
2540
|
}
|
2491
2541
|
|
2492
2542
|
// eslint-disable-next-line func-names
|
2493
2543
|
return (value, opt, opts) => {
|
2494
2544
|
if (validator === false) {
|
2495
|
-
throw new AxiosError(
|
2545
|
+
throw new AxiosError$1(
|
2496
2546
|
formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
|
2497
|
-
AxiosError.ERR_DEPRECATED
|
2547
|
+
AxiosError$1.ERR_DEPRECATED
|
2498
2548
|
);
|
2499
2549
|
}
|
2500
2550
|
|
@@ -2525,7 +2575,7 @@ validators$1.transitional = function transitional(validator, version, message) {
|
|
2525
2575
|
|
2526
2576
|
function assertOptions(options, schema, allowUnknown) {
|
2527
2577
|
if (typeof options !== 'object') {
|
2528
|
-
throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
|
2578
|
+
throw new AxiosError$1('options must be an object', AxiosError$1.ERR_BAD_OPTION_VALUE);
|
2529
2579
|
}
|
2530
2580
|
const keys = Object.keys(options);
|
2531
2581
|
let i = keys.length;
|
@@ -2536,12 +2586,12 @@ function assertOptions(options, schema, allowUnknown) {
|
|
2536
2586
|
const value = options[opt];
|
2537
2587
|
const result = value === undefined || validator(value, opt, options);
|
2538
2588
|
if (result !== true) {
|
2539
|
-
throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
|
2589
|
+
throw new AxiosError$1('option ' + opt + ' must be ' + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
|
2540
2590
|
}
|
2541
2591
|
continue;
|
2542
2592
|
}
|
2543
2593
|
if (allowUnknown !== true) {
|
2544
|
-
throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
|
2594
|
+
throw new AxiosError$1('Unknown option ' + opt, AxiosError$1.ERR_BAD_OPTION);
|
2545
2595
|
}
|
2546
2596
|
}
|
2547
2597
|
}
|
@@ -2560,12 +2610,12 @@ const validators = validator.validators;
|
|
2560
2610
|
*
|
2561
2611
|
* @return {Axios} A new instance of Axios
|
2562
2612
|
*/
|
2563
|
-
class Axios {
|
2613
|
+
class Axios$1 {
|
2564
2614
|
constructor(instanceConfig) {
|
2565
2615
|
this.defaults = instanceConfig;
|
2566
2616
|
this.interceptors = {
|
2567
|
-
request: new InterceptorManager(),
|
2568
|
-
response: new InterceptorManager()
|
2617
|
+
request: new InterceptorManager$1(),
|
2618
|
+
response: new InterceptorManager$1()
|
2569
2619
|
};
|
2570
2620
|
}
|
2571
2621
|
|
@@ -2589,7 +2639,7 @@ class Axios {
|
|
2589
2639
|
|
2590
2640
|
config = mergeConfig(this.defaults, config);
|
2591
2641
|
|
2592
|
-
const {transitional, paramsSerializer} = config;
|
2642
|
+
const {transitional, paramsSerializer, headers} = config;
|
2593
2643
|
|
2594
2644
|
if (transitional !== undefined) {
|
2595
2645
|
validator.assertOptions(transitional, {
|
@@ -2609,20 +2659,22 @@ class Axios {
|
|
2609
2659
|
// Set config.method
|
2610
2660
|
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
2611
2661
|
|
2662
|
+
let contextHeaders;
|
2663
|
+
|
2612
2664
|
// Flatten headers
|
2613
|
-
|
2614
|
-
|
2615
|
-
|
2665
|
+
contextHeaders = headers && utils.merge(
|
2666
|
+
headers.common,
|
2667
|
+
headers[config.method]
|
2616
2668
|
);
|
2617
2669
|
|
2618
|
-
|
2670
|
+
contextHeaders && utils.forEach(
|
2619
2671
|
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
2620
|
-
|
2621
|
-
delete
|
2672
|
+
(method) => {
|
2673
|
+
delete headers[method];
|
2622
2674
|
}
|
2623
2675
|
);
|
2624
2676
|
|
2625
|
-
config.headers =
|
2677
|
+
config.headers = AxiosHeaders$2.concat(contextHeaders, headers);
|
2626
2678
|
|
2627
2679
|
// filter out skipped interceptors
|
2628
2680
|
const requestInterceptorChain = [];
|
@@ -2704,7 +2756,7 @@ class Axios {
|
|
2704
2756
|
// Provide aliases for supported request methods
|
2705
2757
|
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
2706
2758
|
/*eslint func-names:0*/
|
2707
|
-
Axios.prototype[method] = function(url, config) {
|
2759
|
+
Axios$1.prototype[method] = function(url, config) {
|
2708
2760
|
return this.request(mergeConfig(config || {}, {
|
2709
2761
|
method,
|
2710
2762
|
url,
|
@@ -2729,11 +2781,13 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
2729
2781
|
};
|
2730
2782
|
}
|
2731
2783
|
|
2732
|
-
Axios.prototype[method] = generateHTTPMethod();
|
2784
|
+
Axios$1.prototype[method] = generateHTTPMethod();
|
2733
2785
|
|
2734
|
-
Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
|
2786
|
+
Axios$1.prototype[method + 'Form'] = generateHTTPMethod(true);
|
2735
2787
|
});
|
2736
2788
|
|
2789
|
+
const Axios$2 = Axios$1;
|
2790
|
+
|
2737
2791
|
/**
|
2738
2792
|
* A `CancelToken` is an object that can be used to request cancellation of an operation.
|
2739
2793
|
*
|
@@ -2741,7 +2795,7 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
2741
2795
|
*
|
2742
2796
|
* @returns {CancelToken}
|
2743
2797
|
*/
|
2744
|
-
class CancelToken {
|
2798
|
+
class CancelToken$1 {
|
2745
2799
|
constructor(executor) {
|
2746
2800
|
if (typeof executor !== 'function') {
|
2747
2801
|
throw new TypeError('executor must be a function.');
|
@@ -2789,7 +2843,7 @@ class CancelToken {
|
|
2789
2843
|
return;
|
2790
2844
|
}
|
2791
2845
|
|
2792
|
-
token.reason = new CanceledError(message, config, request);
|
2846
|
+
token.reason = new CanceledError$1(message, config, request);
|
2793
2847
|
resolvePromise(token.reason);
|
2794
2848
|
});
|
2795
2849
|
}
|
@@ -2840,7 +2894,7 @@ class CancelToken {
|
|
2840
2894
|
*/
|
2841
2895
|
static source() {
|
2842
2896
|
let cancel;
|
2843
|
-
const token = new CancelToken(function executor(c) {
|
2897
|
+
const token = new CancelToken$1(function executor(c) {
|
2844
2898
|
cancel = c;
|
2845
2899
|
});
|
2846
2900
|
return {
|
@@ -2850,6 +2904,8 @@ class CancelToken {
|
|
2850
2904
|
}
|
2851
2905
|
}
|
2852
2906
|
|
2907
|
+
const CancelToken$2 = CancelToken$1;
|
2908
|
+
|
2853
2909
|
/**
|
2854
2910
|
* Syntactic sugar for invoking a function and expanding an array for arguments.
|
2855
2911
|
*
|
@@ -2871,7 +2927,7 @@ class CancelToken {
|
|
2871
2927
|
*
|
2872
2928
|
* @returns {Function}
|
2873
2929
|
*/
|
2874
|
-
function spread(callback) {
|
2930
|
+
function spread$1(callback) {
|
2875
2931
|
return function wrap(arr) {
|
2876
2932
|
return callback.apply(null, arr);
|
2877
2933
|
};
|
@@ -2884,7 +2940,7 @@ function spread(callback) {
|
|
2884
2940
|
*
|
2885
2941
|
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
2886
2942
|
*/
|
2887
|
-
function isAxiosError(payload) {
|
2943
|
+
function isAxiosError$1(payload) {
|
2888
2944
|
return utils.isObject(payload) && (payload.isAxiosError === true);
|
2889
2945
|
}
|
2890
2946
|
|
@@ -2896,11 +2952,11 @@ function isAxiosError(payload) {
|
|
2896
2952
|
* @returns {Axios} A new instance of Axios
|
2897
2953
|
*/
|
2898
2954
|
function createInstance(defaultConfig) {
|
2899
|
-
const context = new Axios(defaultConfig);
|
2900
|
-
const instance = bind(Axios.prototype.request, context);
|
2955
|
+
const context = new Axios$2(defaultConfig);
|
2956
|
+
const instance = bind(Axios$2.prototype.request, context);
|
2901
2957
|
|
2902
2958
|
// Copy axios.prototype to instance
|
2903
|
-
utils.extend(instance, Axios.prototype, context, {allOwnKeys: true});
|
2959
|
+
utils.extend(instance, Axios$2.prototype, context, {allOwnKeys: true});
|
2904
2960
|
|
2905
2961
|
// Copy context to instance
|
2906
2962
|
utils.extend(instance, context, null, {allOwnKeys: true});
|
@@ -2914,20 +2970,20 @@ function createInstance(defaultConfig) {
|
|
2914
2970
|
}
|
2915
2971
|
|
2916
2972
|
// Create the default instance to be exported
|
2917
|
-
const axios = createInstance(defaults);
|
2973
|
+
const axios = createInstance(defaults$1);
|
2918
2974
|
|
2919
2975
|
// Expose Axios class to allow class inheritance
|
2920
|
-
axios.Axios = Axios;
|
2976
|
+
axios.Axios = Axios$2;
|
2921
2977
|
|
2922
2978
|
// Expose Cancel & CancelToken
|
2923
|
-
axios.CanceledError = CanceledError;
|
2924
|
-
axios.CancelToken = CancelToken;
|
2925
|
-
axios.isCancel = isCancel;
|
2926
|
-
axios.VERSION = VERSION;
|
2927
|
-
axios.toFormData = toFormData;
|
2979
|
+
axios.CanceledError = CanceledError$1;
|
2980
|
+
axios.CancelToken = CancelToken$2;
|
2981
|
+
axios.isCancel = isCancel$1;
|
2982
|
+
axios.VERSION = VERSION$1;
|
2983
|
+
axios.toFormData = toFormData$1;
|
2928
2984
|
|
2929
2985
|
// Expose AxiosError class
|
2930
|
-
axios.AxiosError = AxiosError;
|
2986
|
+
axios.AxiosError = AxiosError$1;
|
2931
2987
|
|
2932
2988
|
// alias for CanceledError for backward compatibility
|
2933
2989
|
axios.Cancel = axios.CanceledError;
|
@@ -2937,14 +2993,38 @@ axios.all = function all(promises) {
|
|
2937
2993
|
return Promise.all(promises);
|
2938
2994
|
};
|
2939
2995
|
|
2940
|
-
axios.spread = spread;
|
2996
|
+
axios.spread = spread$1;
|
2941
2997
|
|
2942
2998
|
// Expose isAxiosError
|
2943
|
-
axios.isAxiosError = isAxiosError;
|
2944
|
-
|
2945
|
-
axios.
|
2946
|
-
|
2947
|
-
|
2948
|
-
|
2949
|
-
|
2999
|
+
axios.isAxiosError = isAxiosError$1;
|
3000
|
+
|
3001
|
+
axios.AxiosHeaders = AxiosHeaders$2;
|
3002
|
+
|
3003
|
+
axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
|
3004
|
+
|
3005
|
+
axios.default = axios;
|
3006
|
+
|
3007
|
+
// this module should only have a default export
|
3008
|
+
const axios$1 = axios;
|
3009
|
+
|
3010
|
+
// This module is intended to unwrap Axios default export as named.
|
3011
|
+
// Keep top-level export same with static properties
|
3012
|
+
// so that it can keep same with es module or cjs
|
3013
|
+
const {
|
3014
|
+
Axios,
|
3015
|
+
AxiosError,
|
3016
|
+
CanceledError,
|
3017
|
+
isCancel,
|
3018
|
+
CancelToken,
|
3019
|
+
VERSION,
|
3020
|
+
all,
|
3021
|
+
Cancel,
|
3022
|
+
isAxiosError,
|
3023
|
+
spread,
|
3024
|
+
toFormData,
|
3025
|
+
AxiosHeaders,
|
3026
|
+
formToJSON
|
3027
|
+
} = axios$1;
|
3028
|
+
|
3029
|
+
export { Axios, AxiosError, AxiosHeaders, Cancel, CancelToken, CanceledError, VERSION, all, axios$1 as default, formToJSON, isAxiosError, isCancel, spread, toFormData };
|
2950
3030
|
//# sourceMappingURL=axios.js.map
|