axios 1.7.9 → 1.12.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 +200 -0
- package/README.md +62 -37
- package/dist/axios.js +438 -327
- package/dist/axios.js.map +1 -1
- package/dist/axios.min.js +2 -1
- package/dist/axios.min.js.map +1 -1
- package/dist/browser/axios.cjs +369 -249
- package/dist/browser/axios.cjs.map +1 -1
- package/dist/esm/axios.js +369 -249
- package/dist/esm/axios.js.map +1 -1
- package/dist/esm/axios.min.js +2 -1
- package/dist/esm/axios.min.js.map +1 -1
- package/dist/node/axios.cjs +491 -253
- package/dist/node/axios.cjs.map +1 -1
- package/index.d.cts +26 -10
- package/index.d.ts +16 -7
- package/lib/adapters/adapters.js +6 -4
- package/lib/adapters/fetch.js +220 -163
- package/lib/adapters/http.js +19 -1
- package/lib/adapters/xhr.js +11 -8
- package/lib/core/Axios.js +13 -4
- package/lib/core/AxiosError.js +10 -3
- package/lib/core/AxiosHeaders.js +15 -3
- package/lib/core/buildFullPath.js +3 -2
- package/lib/core/dispatchRequest.js +1 -1
- package/lib/core/mergeConfig.js +1 -1
- package/lib/defaults/index.js +1 -1
- package/lib/env/data.js +1 -1
- package/lib/helpers/buildURL.js +1 -3
- package/lib/helpers/estimateDataURLDecodedBytes.js +73 -0
- package/lib/helpers/formDataToStream.js +4 -3
- package/lib/helpers/resolveConfig.js +14 -10
- package/lib/helpers/throttle.js +1 -1
- package/lib/helpers/toFormData.js +4 -0
- package/lib/helpers/toURLEncodedForm.js +4 -3
- package/lib/platform/node/index.js +26 -0
- package/lib/utils.js +52 -28
- package/package.json +24 -12
- package/SECURITY.md +0 -6
package/dist/esm/axios.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Axios v1.12.0 Copyright (c) 2025 Matt Zabriskie and contributors */
|
|
2
2
|
function bind(fn, thisArg) {
|
|
3
3
|
return function wrap() {
|
|
4
4
|
return fn.apply(thisArg, arguments);
|
|
@@ -9,6 +9,7 @@ function bind(fn, thisArg) {
|
|
|
9
9
|
|
|
10
10
|
const {toString} = Object.prototype;
|
|
11
11
|
const {getPrototypeOf} = Object;
|
|
12
|
+
const {iterator, toStringTag} = Symbol;
|
|
12
13
|
|
|
13
14
|
const kindOf = (cache => thing => {
|
|
14
15
|
const str = toString.call(thing);
|
|
@@ -49,7 +50,7 @@ const isUndefined = typeOfTest('undefined');
|
|
|
49
50
|
*/
|
|
50
51
|
function isBuffer(val) {
|
|
51
52
|
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
|
|
52
|
-
&& isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
53
|
+
&& isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
/**
|
|
@@ -94,7 +95,7 @@ const isString = typeOfTest('string');
|
|
|
94
95
|
* @param {*} val The value to test
|
|
95
96
|
* @returns {boolean} True if value is a Function, otherwise false
|
|
96
97
|
*/
|
|
97
|
-
const isFunction = typeOfTest('function');
|
|
98
|
+
const isFunction$1 = typeOfTest('function');
|
|
98
99
|
|
|
99
100
|
/**
|
|
100
101
|
* Determine if a value is a Number
|
|
@@ -135,7 +136,28 @@ const isPlainObject = (val) => {
|
|
|
135
136
|
}
|
|
136
137
|
|
|
137
138
|
const prototype = getPrototypeOf(val);
|
|
138
|
-
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(
|
|
139
|
+
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Determine if a value is an empty object (safely handles Buffers)
|
|
144
|
+
*
|
|
145
|
+
* @param {*} val The value to test
|
|
146
|
+
*
|
|
147
|
+
* @returns {boolean} True if value is an empty object, otherwise false
|
|
148
|
+
*/
|
|
149
|
+
const isEmptyObject = (val) => {
|
|
150
|
+
// Early return for non-objects or Buffers to prevent RangeError
|
|
151
|
+
if (!isObject(val) || isBuffer(val)) {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
try {
|
|
156
|
+
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
|
157
|
+
} catch (e) {
|
|
158
|
+
// Fallback for any other objects that might cause RangeError with Object.keys()
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
139
161
|
};
|
|
140
162
|
|
|
141
163
|
/**
|
|
@@ -181,7 +203,7 @@ const isFileList = kindOfTest('FileList');
|
|
|
181
203
|
*
|
|
182
204
|
* @returns {boolean} True if value is a Stream, otherwise false
|
|
183
205
|
*/
|
|
184
|
-
const isStream = (val) => isObject(val) && isFunction(val.pipe);
|
|
206
|
+
const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
|
|
185
207
|
|
|
186
208
|
/**
|
|
187
209
|
* Determine if a value is a FormData
|
|
@@ -194,10 +216,10 @@ const isFormData = (thing) => {
|
|
|
194
216
|
let kind;
|
|
195
217
|
return thing && (
|
|
196
218
|
(typeof FormData === 'function' && thing instanceof FormData) || (
|
|
197
|
-
isFunction(thing.append) && (
|
|
219
|
+
isFunction$1(thing.append) && (
|
|
198
220
|
(kind = kindOf(thing)) === 'formdata' ||
|
|
199
221
|
// detect form-data instance
|
|
200
|
-
(kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')
|
|
222
|
+
(kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
|
|
201
223
|
)
|
|
202
224
|
)
|
|
203
225
|
)
|
|
@@ -260,6 +282,11 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
|
260
282
|
fn.call(null, obj[i], i, obj);
|
|
261
283
|
}
|
|
262
284
|
} else {
|
|
285
|
+
// Buffer check
|
|
286
|
+
if (isBuffer(obj)) {
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
|
|
263
290
|
// Iterate over object keys
|
|
264
291
|
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
265
292
|
const len = keys.length;
|
|
@@ -273,6 +300,10 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
|
273
300
|
}
|
|
274
301
|
|
|
275
302
|
function findKey(obj, key) {
|
|
303
|
+
if (isBuffer(obj)){
|
|
304
|
+
return null;
|
|
305
|
+
}
|
|
306
|
+
|
|
276
307
|
key = key.toLowerCase();
|
|
277
308
|
const keys = Object.keys(obj);
|
|
278
309
|
let i = keys.length;
|
|
@@ -313,7 +344,7 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
|
|
|
313
344
|
* @returns {Object} Result of all merge properties
|
|
314
345
|
*/
|
|
315
346
|
function merge(/* obj1, obj2, obj3, ... */) {
|
|
316
|
-
const {caseless} = isContextDefined(this) && this || {};
|
|
347
|
+
const {caseless, skipUndefined} = isContextDefined(this) && this || {};
|
|
317
348
|
const result = {};
|
|
318
349
|
const assignValue = (val, key) => {
|
|
319
350
|
const targetKey = caseless && findKey(result, key) || key;
|
|
@@ -324,7 +355,9 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
324
355
|
} else if (isArray(val)) {
|
|
325
356
|
result[targetKey] = val.slice();
|
|
326
357
|
} else {
|
|
327
|
-
|
|
358
|
+
if (!skipUndefined || !isUndefined(val)) {
|
|
359
|
+
result[targetKey] = val;
|
|
360
|
+
}
|
|
328
361
|
}
|
|
329
362
|
};
|
|
330
363
|
|
|
@@ -346,7 +379,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
346
379
|
*/
|
|
347
380
|
const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
|
|
348
381
|
forEach(b, (val, key) => {
|
|
349
|
-
if (thisArg && isFunction(val)) {
|
|
382
|
+
if (thisArg && isFunction$1(val)) {
|
|
350
383
|
a[key] = bind(val, thisArg);
|
|
351
384
|
} else {
|
|
352
385
|
a[key] = val;
|
|
@@ -486,13 +519,13 @@ const isTypedArray = (TypedArray => {
|
|
|
486
519
|
* @returns {void}
|
|
487
520
|
*/
|
|
488
521
|
const forEachEntry = (obj, fn) => {
|
|
489
|
-
const generator = obj && obj[
|
|
522
|
+
const generator = obj && obj[iterator];
|
|
490
523
|
|
|
491
|
-
const
|
|
524
|
+
const _iterator = generator.call(obj);
|
|
492
525
|
|
|
493
526
|
let result;
|
|
494
527
|
|
|
495
|
-
while ((result =
|
|
528
|
+
while ((result = _iterator.next()) && !result.done) {
|
|
496
529
|
const pair = result.value;
|
|
497
530
|
fn.call(obj, pair[0], pair[1]);
|
|
498
531
|
}
|
|
@@ -562,13 +595,13 @@ const reduceDescriptors = (obj, reducer) => {
|
|
|
562
595
|
const freezeMethods = (obj) => {
|
|
563
596
|
reduceDescriptors(obj, (descriptor, name) => {
|
|
564
597
|
// skip restricted props in strict mode
|
|
565
|
-
if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
|
598
|
+
if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
|
566
599
|
return false;
|
|
567
600
|
}
|
|
568
601
|
|
|
569
602
|
const value = obj[name];
|
|
570
603
|
|
|
571
|
-
if (!isFunction(value)) return;
|
|
604
|
+
if (!isFunction$1(value)) return;
|
|
572
605
|
|
|
573
606
|
descriptor.enumerable = false;
|
|
574
607
|
|
|
@@ -605,25 +638,7 @@ const toFiniteNumber = (value, defaultValue) => {
|
|
|
605
638
|
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
|
|
606
639
|
};
|
|
607
640
|
|
|
608
|
-
const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
|
|
609
641
|
|
|
610
|
-
const DIGIT = '0123456789';
|
|
611
|
-
|
|
612
|
-
const ALPHABET = {
|
|
613
|
-
DIGIT,
|
|
614
|
-
ALPHA,
|
|
615
|
-
ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
|
|
616
|
-
};
|
|
617
|
-
|
|
618
|
-
const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
|
|
619
|
-
let str = '';
|
|
620
|
-
const {length} = alphabet;
|
|
621
|
-
while (size--) {
|
|
622
|
-
str += alphabet[Math.random() * length|0];
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
return str;
|
|
626
|
-
};
|
|
627
642
|
|
|
628
643
|
/**
|
|
629
644
|
* If the thing is a FormData object, return true, otherwise return false.
|
|
@@ -633,7 +648,7 @@ const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
|
|
|
633
648
|
* @returns {boolean}
|
|
634
649
|
*/
|
|
635
650
|
function isSpecCompliantForm(thing) {
|
|
636
|
-
return !!(thing && isFunction(thing.append) && thing[
|
|
651
|
+
return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
|
|
637
652
|
}
|
|
638
653
|
|
|
639
654
|
const toJSONObject = (obj) => {
|
|
@@ -646,6 +661,11 @@ const toJSONObject = (obj) => {
|
|
|
646
661
|
return;
|
|
647
662
|
}
|
|
648
663
|
|
|
664
|
+
//Buffer check
|
|
665
|
+
if (isBuffer(source)) {
|
|
666
|
+
return source;
|
|
667
|
+
}
|
|
668
|
+
|
|
649
669
|
if(!('toJSON' in source)) {
|
|
650
670
|
stack[i] = source;
|
|
651
671
|
const target = isArray(source) ? [] : {};
|
|
@@ -670,7 +690,7 @@ const toJSONObject = (obj) => {
|
|
|
670
690
|
const isAsyncFn = kindOfTest('AsyncFunction');
|
|
671
691
|
|
|
672
692
|
const isThenable = (thing) =>
|
|
673
|
-
thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
|
|
693
|
+
thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
|
|
674
694
|
|
|
675
695
|
// original code
|
|
676
696
|
// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
|
|
@@ -694,7 +714,7 @@ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
|
694
714
|
})(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
|
|
695
715
|
})(
|
|
696
716
|
typeof setImmediate === 'function',
|
|
697
|
-
isFunction(_global.postMessage)
|
|
717
|
+
isFunction$1(_global.postMessage)
|
|
698
718
|
);
|
|
699
719
|
|
|
700
720
|
const asap = typeof queueMicrotask !== 'undefined' ?
|
|
@@ -702,6 +722,10 @@ const asap = typeof queueMicrotask !== 'undefined' ?
|
|
|
702
722
|
|
|
703
723
|
// *********************
|
|
704
724
|
|
|
725
|
+
|
|
726
|
+
const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
|
|
727
|
+
|
|
728
|
+
|
|
705
729
|
const utils$1 = {
|
|
706
730
|
isArray,
|
|
707
731
|
isArrayBuffer,
|
|
@@ -713,6 +737,7 @@ const utils$1 = {
|
|
|
713
737
|
isBoolean,
|
|
714
738
|
isObject,
|
|
715
739
|
isPlainObject,
|
|
740
|
+
isEmptyObject,
|
|
716
741
|
isReadableStream,
|
|
717
742
|
isRequest,
|
|
718
743
|
isResponse,
|
|
@@ -722,7 +747,7 @@ const utils$1 = {
|
|
|
722
747
|
isFile,
|
|
723
748
|
isBlob,
|
|
724
749
|
isRegExp,
|
|
725
|
-
isFunction,
|
|
750
|
+
isFunction: isFunction$1,
|
|
726
751
|
isStream,
|
|
727
752
|
isURLSearchParams,
|
|
728
753
|
isTypedArray,
|
|
@@ -752,14 +777,13 @@ const utils$1 = {
|
|
|
752
777
|
findKey,
|
|
753
778
|
global: _global,
|
|
754
779
|
isContextDefined,
|
|
755
|
-
ALPHABET,
|
|
756
|
-
generateString,
|
|
757
780
|
isSpecCompliantForm,
|
|
758
781
|
toJSONObject,
|
|
759
782
|
isAsyncFn,
|
|
760
783
|
isThenable,
|
|
761
784
|
setImmediate: _setImmediate,
|
|
762
|
-
asap
|
|
785
|
+
asap,
|
|
786
|
+
isIterable
|
|
763
787
|
};
|
|
764
788
|
|
|
765
789
|
/**
|
|
@@ -849,11 +873,18 @@ AxiosError$1.from = (error, code, config, request, response, customProps) => {
|
|
|
849
873
|
return prop !== 'isAxiosError';
|
|
850
874
|
});
|
|
851
875
|
|
|
852
|
-
|
|
876
|
+
const msg = error && error.message ? error.message : 'Error';
|
|
877
|
+
|
|
878
|
+
// Prefer explicit code; otherwise copy the low-level error's code (e.g. ECONNREFUSED)
|
|
879
|
+
const errCode = code == null && error ? error.code : code;
|
|
880
|
+
AxiosError$1.call(axiosError, msg, errCode, config, request, response);
|
|
853
881
|
|
|
854
|
-
|
|
882
|
+
// Chain the original error on the standard field; non-enumerable to avoid JSON noise
|
|
883
|
+
if (error && axiosError.cause == null) {
|
|
884
|
+
Object.defineProperty(axiosError, 'cause', { value: error, configurable: true });
|
|
885
|
+
}
|
|
855
886
|
|
|
856
|
-
axiosError.name = error.name;
|
|
887
|
+
axiosError.name = (error && error.name) || 'Error';
|
|
857
888
|
|
|
858
889
|
customProps && Object.assign(axiosError, customProps);
|
|
859
890
|
|
|
@@ -978,6 +1009,10 @@ function toFormData$1(obj, formData, options) {
|
|
|
978
1009
|
return value.toISOString();
|
|
979
1010
|
}
|
|
980
1011
|
|
|
1012
|
+
if (utils$1.isBoolean(value)) {
|
|
1013
|
+
return value.toString();
|
|
1014
|
+
}
|
|
1015
|
+
|
|
981
1016
|
if (!useBlob && utils$1.isBlob(value)) {
|
|
982
1017
|
throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
|
|
983
1018
|
}
|
|
@@ -1140,9 +1175,7 @@ function encode(val) {
|
|
|
1140
1175
|
replace(/%3A/gi, ':').
|
|
1141
1176
|
replace(/%24/g, '$').
|
|
1142
1177
|
replace(/%2C/gi, ',').
|
|
1143
|
-
replace(/%20/g, '+')
|
|
1144
|
-
replace(/%5B/gi, '[').
|
|
1145
|
-
replace(/%5D/gi, ']');
|
|
1178
|
+
replace(/%20/g, '+');
|
|
1146
1179
|
}
|
|
1147
1180
|
|
|
1148
1181
|
/**
|
|
@@ -1341,7 +1374,7 @@ const platform = {
|
|
|
1341
1374
|
};
|
|
1342
1375
|
|
|
1343
1376
|
function toURLEncodedForm(data, options) {
|
|
1344
|
-
return toFormData$1(data, new platform.classes.URLSearchParams(),
|
|
1377
|
+
return toFormData$1(data, new platform.classes.URLSearchParams(), {
|
|
1345
1378
|
visitor: function(value, key, path, helpers) {
|
|
1346
1379
|
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
1347
1380
|
this.append(key, value.toString('base64'));
|
|
@@ -1349,8 +1382,9 @@ function toURLEncodedForm(data, options) {
|
|
|
1349
1382
|
}
|
|
1350
1383
|
|
|
1351
1384
|
return helpers.defaultVisitor.apply(this, arguments);
|
|
1352
|
-
}
|
|
1353
|
-
|
|
1385
|
+
},
|
|
1386
|
+
...options
|
|
1387
|
+
});
|
|
1354
1388
|
}
|
|
1355
1389
|
|
|
1356
1390
|
/**
|
|
@@ -1546,7 +1580,7 @@ const defaults = {
|
|
|
1546
1580
|
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
1547
1581
|
|
|
1548
1582
|
try {
|
|
1549
|
-
return JSON.parse(data);
|
|
1583
|
+
return JSON.parse(data, this.parseReviver);
|
|
1550
1584
|
} catch (e) {
|
|
1551
1585
|
if (strictJSONParsing) {
|
|
1552
1586
|
if (e.name === 'SyntaxError') {
|
|
@@ -1744,10 +1778,18 @@ class AxiosHeaders$1 {
|
|
|
1744
1778
|
setHeaders(header, valueOrRewrite);
|
|
1745
1779
|
} else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
1746
1780
|
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
1747
|
-
} else if (utils$1.
|
|
1748
|
-
|
|
1749
|
-
|
|
1781
|
+
} else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
|
|
1782
|
+
let obj = {}, dest, key;
|
|
1783
|
+
for (const entry of header) {
|
|
1784
|
+
if (!utils$1.isArray(entry)) {
|
|
1785
|
+
throw TypeError('Object iterator must return a key-value pair');
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1788
|
+
obj[key = entry[0]] = (dest = obj[key]) ?
|
|
1789
|
+
(utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]]) : entry[1];
|
|
1750
1790
|
}
|
|
1791
|
+
|
|
1792
|
+
setHeaders(obj, valueOrRewrite);
|
|
1751
1793
|
} else {
|
|
1752
1794
|
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
1753
1795
|
}
|
|
@@ -1889,6 +1931,10 @@ class AxiosHeaders$1 {
|
|
|
1889
1931
|
return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
|
|
1890
1932
|
}
|
|
1891
1933
|
|
|
1934
|
+
getSetCookie() {
|
|
1935
|
+
return this.get("set-cookie") || [];
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1892
1938
|
get [Symbol.toStringTag]() {
|
|
1893
1939
|
return 'AxiosHeaders';
|
|
1894
1940
|
}
|
|
@@ -2091,7 +2137,7 @@ function throttle(fn, freq) {
|
|
|
2091
2137
|
clearTimeout(timer);
|
|
2092
2138
|
timer = null;
|
|
2093
2139
|
}
|
|
2094
|
-
fn
|
|
2140
|
+
fn(...args);
|
|
2095
2141
|
};
|
|
2096
2142
|
|
|
2097
2143
|
const throttled = (...args) => {
|
|
@@ -2246,8 +2292,9 @@ function combineURLs(baseURL, relativeURL) {
|
|
|
2246
2292
|
*
|
|
2247
2293
|
* @returns {string} The combined full path
|
|
2248
2294
|
*/
|
|
2249
|
-
function buildFullPath(baseURL, requestedURL) {
|
|
2250
|
-
|
|
2295
|
+
function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
2296
|
+
let isRelativeUrl = !isAbsoluteURL(requestedURL);
|
|
2297
|
+
if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
|
|
2251
2298
|
return combineURLs(baseURL, requestedURL);
|
|
2252
2299
|
}
|
|
2253
2300
|
return requestedURL;
|
|
@@ -2346,7 +2393,7 @@ function mergeConfig$1(config1, config2) {
|
|
|
2346
2393
|
headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
|
|
2347
2394
|
};
|
|
2348
2395
|
|
|
2349
|
-
utils$1.forEach(Object.keys(
|
|
2396
|
+
utils$1.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
|
|
2350
2397
|
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
2351
2398
|
const configValue = merge(config1[prop], config2[prop], prop);
|
|
2352
2399
|
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
@@ -2358,11 +2405,11 @@ function mergeConfig$1(config1, config2) {
|
|
|
2358
2405
|
const resolveConfig = (config) => {
|
|
2359
2406
|
const newConfig = mergeConfig$1({}, config);
|
|
2360
2407
|
|
|
2361
|
-
let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
|
|
2408
|
+
let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
|
|
2362
2409
|
|
|
2363
2410
|
newConfig.headers = headers = AxiosHeaders$2.from(headers);
|
|
2364
2411
|
|
|
2365
|
-
newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
|
|
2412
|
+
newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
|
|
2366
2413
|
|
|
2367
2414
|
// HTTP basic authentication
|
|
2368
2415
|
if (auth) {
|
|
@@ -2371,17 +2418,21 @@ const resolveConfig = (config) => {
|
|
|
2371
2418
|
);
|
|
2372
2419
|
}
|
|
2373
2420
|
|
|
2374
|
-
let contentType;
|
|
2375
|
-
|
|
2376
2421
|
if (utils$1.isFormData(data)) {
|
|
2377
2422
|
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
2378
|
-
headers.setContentType(undefined); //
|
|
2379
|
-
} else if ((
|
|
2380
|
-
//
|
|
2381
|
-
const
|
|
2382
|
-
headers
|
|
2423
|
+
headers.setContentType(undefined); // browser handles it
|
|
2424
|
+
} else if (utils$1.isFunction(data.getHeaders)) {
|
|
2425
|
+
// Node.js FormData (like form-data package)
|
|
2426
|
+
const formHeaders = data.getHeaders();
|
|
2427
|
+
// Only set safe headers to avoid overwriting security headers
|
|
2428
|
+
const allowedHeaders = ['content-type', 'content-length'];
|
|
2429
|
+
Object.entries(formHeaders).forEach(([key, val]) => {
|
|
2430
|
+
if (allowedHeaders.includes(key.toLowerCase())) {
|
|
2431
|
+
headers.set(key, val);
|
|
2432
|
+
}
|
|
2433
|
+
});
|
|
2383
2434
|
}
|
|
2384
|
-
}
|
|
2435
|
+
}
|
|
2385
2436
|
|
|
2386
2437
|
// Add xsrf header
|
|
2387
2438
|
// This is only done if running in a standard browser environment.
|
|
@@ -2498,15 +2549,18 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
2498
2549
|
};
|
|
2499
2550
|
|
|
2500
2551
|
// Handle low level network errors
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2552
|
+
request.onerror = function handleError(event) {
|
|
2553
|
+
// Browsers deliver a ProgressEvent in XHR onerror
|
|
2554
|
+
// (message may be empty; when present, surface it)
|
|
2555
|
+
// See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
|
|
2556
|
+
const msg = event && event.message ? event.message : 'Network Error';
|
|
2557
|
+
const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
|
|
2558
|
+
// attach the underlying event for consumers who want details
|
|
2559
|
+
err.event = event || null;
|
|
2560
|
+
reject(err);
|
|
2561
|
+
request = null;
|
|
2508
2562
|
};
|
|
2509
|
-
|
|
2563
|
+
|
|
2510
2564
|
// Handle timeout
|
|
2511
2565
|
request.ontimeout = function handleTimeout() {
|
|
2512
2566
|
let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
|
|
@@ -2722,14 +2776,18 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
|
2722
2776
|
})
|
|
2723
2777
|
};
|
|
2724
2778
|
|
|
2725
|
-
const
|
|
2726
|
-
|
|
2779
|
+
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
2780
|
+
|
|
2781
|
+
const {isFunction} = utils$1;
|
|
2782
|
+
|
|
2783
|
+
const globalFetchAPI = (({fetch, Request, Response}) => ({
|
|
2784
|
+
fetch, Request, Response
|
|
2785
|
+
}))(utils$1.global);
|
|
2786
|
+
|
|
2787
|
+
const {
|
|
2788
|
+
ReadableStream: ReadableStream$1, TextEncoder
|
|
2789
|
+
} = utils$1.global;
|
|
2727
2790
|
|
|
2728
|
-
// used only inside the fetch adapter
|
|
2729
|
-
const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
|
|
2730
|
-
((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
|
|
2731
|
-
async (str) => new Uint8Array(await new Response(str).arrayBuffer())
|
|
2732
|
-
);
|
|
2733
2791
|
|
|
2734
2792
|
const test = (fn, ...args) => {
|
|
2735
2793
|
try {
|
|
@@ -2739,211 +2797,266 @@ const test = (fn, ...args) => {
|
|
|
2739
2797
|
}
|
|
2740
2798
|
};
|
|
2741
2799
|
|
|
2742
|
-
const
|
|
2743
|
-
|
|
2800
|
+
const factory = (env) => {
|
|
2801
|
+
const {fetch, Request, Response} = Object.assign({}, globalFetchAPI, env);
|
|
2802
|
+
const isFetchSupported = isFunction(fetch);
|
|
2803
|
+
const isRequestSupported = isFunction(Request);
|
|
2804
|
+
const isResponseSupported = isFunction(Response);
|
|
2744
2805
|
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
get duplex() {
|
|
2749
|
-
duplexAccessed = true;
|
|
2750
|
-
return 'half';
|
|
2751
|
-
},
|
|
2752
|
-
}).headers.has('Content-Type');
|
|
2806
|
+
if (!isFetchSupported) {
|
|
2807
|
+
return false;
|
|
2808
|
+
}
|
|
2753
2809
|
|
|
2754
|
-
|
|
2755
|
-
});
|
|
2810
|
+
const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
|
|
2756
2811
|
|
|
2757
|
-
const
|
|
2812
|
+
const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
|
|
2813
|
+
((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
|
|
2814
|
+
async (str) => new Uint8Array(await new Request(str).arrayBuffer())
|
|
2815
|
+
);
|
|
2816
|
+
|
|
2817
|
+
const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
|
|
2818
|
+
let duplexAccessed = false;
|
|
2819
|
+
|
|
2820
|
+
const hasContentType = new Request(platform.origin, {
|
|
2821
|
+
body: new ReadableStream$1(),
|
|
2822
|
+
method: 'POST',
|
|
2823
|
+
get duplex() {
|
|
2824
|
+
duplexAccessed = true;
|
|
2825
|
+
return 'half';
|
|
2826
|
+
},
|
|
2827
|
+
}).headers.has('Content-Type');
|
|
2758
2828
|
|
|
2759
|
-
|
|
2760
|
-
|
|
2829
|
+
return duplexAccessed && !hasContentType;
|
|
2830
|
+
});
|
|
2761
2831
|
|
|
2832
|
+
const supportsResponseStream = isResponseSupported && isReadableStreamSupported &&
|
|
2833
|
+
test(() => utils$1.isReadableStream(new Response('').body));
|
|
2762
2834
|
|
|
2763
|
-
const resolvers = {
|
|
2764
|
-
|
|
2765
|
-
};
|
|
2835
|
+
const resolvers = {
|
|
2836
|
+
stream: supportsResponseStream && ((res) => res.body)
|
|
2837
|
+
};
|
|
2838
|
+
|
|
2839
|
+
isFetchSupported && ((() => {
|
|
2840
|
+
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
|
|
2841
|
+
!resolvers[type] && (resolvers[type] = (res, config) => {
|
|
2842
|
+
let method = res && res[type];
|
|
2843
|
+
|
|
2844
|
+
if (method) {
|
|
2845
|
+
return method.call(res);
|
|
2846
|
+
}
|
|
2766
2847
|
|
|
2767
|
-
isFetchSupported && (((res) => {
|
|
2768
|
-
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
|
|
2769
|
-
!resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
|
|
2770
|
-
(_, config) => {
|
|
2771
2848
|
throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
|
|
2772
2849
|
});
|
|
2773
|
-
|
|
2774
|
-
})(
|
|
2850
|
+
});
|
|
2851
|
+
})());
|
|
2775
2852
|
|
|
2776
|
-
const getBodyLength = async (body) => {
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2853
|
+
const getBodyLength = async (body) => {
|
|
2854
|
+
if (body == null) {
|
|
2855
|
+
return 0;
|
|
2856
|
+
}
|
|
2780
2857
|
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2858
|
+
if (utils$1.isBlob(body)) {
|
|
2859
|
+
return body.size;
|
|
2860
|
+
}
|
|
2784
2861
|
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2862
|
+
if (utils$1.isSpecCompliantForm(body)) {
|
|
2863
|
+
const _request = new Request(platform.origin, {
|
|
2864
|
+
method: 'POST',
|
|
2865
|
+
body,
|
|
2866
|
+
});
|
|
2867
|
+
return (await _request.arrayBuffer()).byteLength;
|
|
2868
|
+
}
|
|
2792
2869
|
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2870
|
+
if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
|
|
2871
|
+
return body.byteLength;
|
|
2872
|
+
}
|
|
2796
2873
|
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2874
|
+
if (utils$1.isURLSearchParams(body)) {
|
|
2875
|
+
body = body + '';
|
|
2876
|
+
}
|
|
2800
2877
|
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
};
|
|
2878
|
+
if (utils$1.isString(body)) {
|
|
2879
|
+
return (await encodeText(body)).byteLength;
|
|
2880
|
+
}
|
|
2881
|
+
};
|
|
2805
2882
|
|
|
2806
|
-
const resolveBodyLength = async (headers, body) => {
|
|
2807
|
-
|
|
2883
|
+
const resolveBodyLength = async (headers, body) => {
|
|
2884
|
+
const length = utils$1.toFiniteNumber(headers.getContentLength());
|
|
2808
2885
|
|
|
2809
|
-
|
|
2810
|
-
};
|
|
2886
|
+
return length == null ? getBodyLength(body) : length;
|
|
2887
|
+
};
|
|
2888
|
+
|
|
2889
|
+
return async (config) => {
|
|
2890
|
+
let {
|
|
2891
|
+
url,
|
|
2892
|
+
method,
|
|
2893
|
+
data,
|
|
2894
|
+
signal,
|
|
2895
|
+
cancelToken,
|
|
2896
|
+
timeout,
|
|
2897
|
+
onDownloadProgress,
|
|
2898
|
+
onUploadProgress,
|
|
2899
|
+
responseType,
|
|
2900
|
+
headers,
|
|
2901
|
+
withCredentials = 'same-origin',
|
|
2902
|
+
fetchOptions
|
|
2903
|
+
} = resolveConfig(config);
|
|
2904
|
+
|
|
2905
|
+
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
2906
|
+
|
|
2907
|
+
let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
|
2811
2908
|
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
method,
|
|
2816
|
-
data,
|
|
2817
|
-
signal,
|
|
2818
|
-
cancelToken,
|
|
2819
|
-
timeout,
|
|
2820
|
-
onDownloadProgress,
|
|
2821
|
-
onUploadProgress,
|
|
2822
|
-
responseType,
|
|
2823
|
-
headers,
|
|
2824
|
-
withCredentials = 'same-origin',
|
|
2825
|
-
fetchOptions
|
|
2826
|
-
} = resolveConfig(config);
|
|
2827
|
-
|
|
2828
|
-
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
2829
|
-
|
|
2830
|
-
let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
|
2831
|
-
|
|
2832
|
-
let request;
|
|
2833
|
-
|
|
2834
|
-
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
|
2909
|
+
let request = null;
|
|
2910
|
+
|
|
2911
|
+
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
|
2835
2912
|
composedSignal.unsubscribe();
|
|
2836
|
-
|
|
2913
|
+
});
|
|
2837
2914
|
|
|
2838
|
-
|
|
2915
|
+
let requestContentLength;
|
|
2839
2916
|
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2917
|
+
try {
|
|
2918
|
+
if (
|
|
2919
|
+
onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
|
|
2920
|
+
(requestContentLength = await resolveBodyLength(headers, data)) !== 0
|
|
2921
|
+
) {
|
|
2922
|
+
let _request = new Request(url, {
|
|
2923
|
+
method: 'POST',
|
|
2924
|
+
body: data,
|
|
2925
|
+
duplex: "half"
|
|
2926
|
+
});
|
|
2850
2927
|
|
|
2851
|
-
|
|
2928
|
+
let contentTypeHeader;
|
|
2852
2929
|
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2930
|
+
if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
|
|
2931
|
+
headers.setContentType(contentTypeHeader);
|
|
2932
|
+
}
|
|
2856
2933
|
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2934
|
+
if (_request.body) {
|
|
2935
|
+
const [onProgress, flush] = progressEventDecorator(
|
|
2936
|
+
requestContentLength,
|
|
2937
|
+
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
2938
|
+
);
|
|
2939
|
+
|
|
2940
|
+
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
|
|
2941
|
+
}
|
|
2942
|
+
}
|
|
2862
2943
|
|
|
2863
|
-
|
|
2944
|
+
if (!utils$1.isString(withCredentials)) {
|
|
2945
|
+
withCredentials = withCredentials ? 'include' : 'omit';
|
|
2864
2946
|
}
|
|
2865
|
-
}
|
|
2866
2947
|
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2948
|
+
// Cloudflare Workers throws when credentials are defined
|
|
2949
|
+
// see https://github.com/cloudflare/workerd/issues/902
|
|
2950
|
+
const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
|
|
2870
2951
|
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
duplex: "half",
|
|
2881
|
-
credentials: isCredentialsSupported ? withCredentials : undefined
|
|
2882
|
-
});
|
|
2952
|
+
const resolvedOptions = {
|
|
2953
|
+
...fetchOptions,
|
|
2954
|
+
signal: composedSignal,
|
|
2955
|
+
method: method.toUpperCase(),
|
|
2956
|
+
headers: headers.normalize().toJSON(),
|
|
2957
|
+
body: data,
|
|
2958
|
+
duplex: "half",
|
|
2959
|
+
credentials: isCredentialsSupported ? withCredentials : undefined
|
|
2960
|
+
};
|
|
2883
2961
|
|
|
2884
|
-
|
|
2962
|
+
request = isRequestSupported && new Request(url, resolvedOptions);
|
|
2885
2963
|
|
|
2886
|
-
|
|
2964
|
+
let response = await (isRequestSupported ? fetch(request, fetchOptions) : fetch(url, resolvedOptions));
|
|
2887
2965
|
|
|
2888
|
-
|
|
2889
|
-
const options = {};
|
|
2966
|
+
const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
2890
2967
|
|
|
2891
|
-
|
|
2892
|
-
options
|
|
2893
|
-
});
|
|
2968
|
+
if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
|
|
2969
|
+
const options = {};
|
|
2894
2970
|
|
|
2895
|
-
|
|
2971
|
+
['status', 'statusText', 'headers'].forEach(prop => {
|
|
2972
|
+
options[prop] = response[prop];
|
|
2973
|
+
});
|
|
2896
2974
|
|
|
2897
|
-
|
|
2898
|
-
responseContentLength,
|
|
2899
|
-
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
2900
|
-
) || [];
|
|
2975
|
+
const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
|
|
2901
2976
|
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
}),
|
|
2907
|
-
options
|
|
2908
|
-
);
|
|
2909
|
-
}
|
|
2977
|
+
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
|
|
2978
|
+
responseContentLength,
|
|
2979
|
+
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
2980
|
+
) || [];
|
|
2910
2981
|
|
|
2911
|
-
|
|
2982
|
+
response = new Response(
|
|
2983
|
+
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
2984
|
+
flush && flush();
|
|
2985
|
+
unsubscribe && unsubscribe();
|
|
2986
|
+
}),
|
|
2987
|
+
options
|
|
2988
|
+
);
|
|
2989
|
+
}
|
|
2912
2990
|
|
|
2913
|
-
|
|
2991
|
+
responseType = responseType || 'text';
|
|
2914
2992
|
|
|
2915
|
-
|
|
2993
|
+
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
|
|
2916
2994
|
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2995
|
+
!isStreamResponse && unsubscribe && unsubscribe();
|
|
2996
|
+
|
|
2997
|
+
return await new Promise((resolve, reject) => {
|
|
2998
|
+
settle(resolve, reject, {
|
|
2999
|
+
data: responseData,
|
|
3000
|
+
headers: AxiosHeaders$2.from(response.headers),
|
|
3001
|
+
status: response.status,
|
|
3002
|
+
statusText: response.statusText,
|
|
3003
|
+
config,
|
|
3004
|
+
request
|
|
3005
|
+
});
|
|
3006
|
+
})
|
|
3007
|
+
} catch (err) {
|
|
3008
|
+
unsubscribe && unsubscribe();
|
|
3009
|
+
|
|
3010
|
+
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
|
3011
|
+
throw Object.assign(
|
|
3012
|
+
new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request),
|
|
3013
|
+
{
|
|
3014
|
+
cause: err.cause || err
|
|
3015
|
+
}
|
|
3016
|
+
)
|
|
3017
|
+
}
|
|
3018
|
+
|
|
3019
|
+
throw AxiosError$1.from(err, err && err.code, config, request);
|
|
2937
3020
|
}
|
|
3021
|
+
}
|
|
3022
|
+
};
|
|
3023
|
+
|
|
3024
|
+
const seedCache = new Map();
|
|
3025
|
+
|
|
3026
|
+
const getFetch = (config) => {
|
|
3027
|
+
let env = utils$1.merge.call({
|
|
3028
|
+
skipUndefined: true
|
|
3029
|
+
}, globalFetchAPI, config ? config.env : null);
|
|
3030
|
+
|
|
3031
|
+
const {fetch, Request, Response} = env;
|
|
3032
|
+
|
|
3033
|
+
const seeds = [
|
|
3034
|
+
Request, Response, fetch
|
|
3035
|
+
];
|
|
3036
|
+
|
|
3037
|
+
let len = seeds.length, i = len,
|
|
3038
|
+
seed, target, map = seedCache;
|
|
2938
3039
|
|
|
2939
|
-
|
|
3040
|
+
while (i--) {
|
|
3041
|
+
seed = seeds[i];
|
|
3042
|
+
target = map.get(seed);
|
|
3043
|
+
|
|
3044
|
+
target === undefined && map.set(seed, target = (i ? new Map() : factory(env)));
|
|
3045
|
+
|
|
3046
|
+
map = target;
|
|
2940
3047
|
}
|
|
2941
|
-
|
|
3048
|
+
|
|
3049
|
+
return target;
|
|
3050
|
+
};
|
|
3051
|
+
|
|
3052
|
+
getFetch();
|
|
2942
3053
|
|
|
2943
3054
|
const knownAdapters = {
|
|
2944
3055
|
http: httpAdapter,
|
|
2945
3056
|
xhr: xhrAdapter,
|
|
2946
|
-
fetch:
|
|
3057
|
+
fetch: {
|
|
3058
|
+
get: getFetch,
|
|
3059
|
+
}
|
|
2947
3060
|
};
|
|
2948
3061
|
|
|
2949
3062
|
utils$1.forEach(knownAdapters, (fn, value) => {
|
|
@@ -2962,7 +3075,7 @@ const renderReason = (reason) => `- ${reason}`;
|
|
|
2962
3075
|
const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
2963
3076
|
|
|
2964
3077
|
const adapters = {
|
|
2965
|
-
getAdapter: (adapters) => {
|
|
3078
|
+
getAdapter: (adapters, config) => {
|
|
2966
3079
|
adapters = utils$1.isArray(adapters) ? adapters : [adapters];
|
|
2967
3080
|
|
|
2968
3081
|
const {length} = adapters;
|
|
@@ -2985,7 +3098,7 @@ const adapters = {
|
|
|
2985
3098
|
}
|
|
2986
3099
|
}
|
|
2987
3100
|
|
|
2988
|
-
if (adapter) {
|
|
3101
|
+
if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
|
|
2989
3102
|
break;
|
|
2990
3103
|
}
|
|
2991
3104
|
|
|
@@ -3053,7 +3166,7 @@ function dispatchRequest(config) {
|
|
|
3053
3166
|
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
|
3054
3167
|
}
|
|
3055
3168
|
|
|
3056
|
-
const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
|
|
3169
|
+
const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter, config);
|
|
3057
3170
|
|
|
3058
3171
|
return adapter(config).then(function onAdapterResolution(response) {
|
|
3059
3172
|
throwIfCancellationRequested(config);
|
|
@@ -3087,7 +3200,7 @@ function dispatchRequest(config) {
|
|
|
3087
3200
|
});
|
|
3088
3201
|
}
|
|
3089
3202
|
|
|
3090
|
-
const VERSION$1 = "1.
|
|
3203
|
+
const VERSION$1 = "1.12.0";
|
|
3091
3204
|
|
|
3092
3205
|
const validators$1 = {};
|
|
3093
3206
|
|
|
@@ -3195,7 +3308,7 @@ const validators = validator.validators;
|
|
|
3195
3308
|
*/
|
|
3196
3309
|
class Axios$1 {
|
|
3197
3310
|
constructor(instanceConfig) {
|
|
3198
|
-
this.defaults = instanceConfig;
|
|
3311
|
+
this.defaults = instanceConfig || {};
|
|
3199
3312
|
this.interceptors = {
|
|
3200
3313
|
request: new InterceptorManager$1(),
|
|
3201
3314
|
response: new InterceptorManager$1()
|
|
@@ -3272,6 +3385,13 @@ class Axios$1 {
|
|
|
3272
3385
|
}
|
|
3273
3386
|
}
|
|
3274
3387
|
|
|
3388
|
+
// Set config.allowAbsoluteUrls
|
|
3389
|
+
if (config.allowAbsoluteUrls !== undefined) ; else if (this.defaults.allowAbsoluteUrls !== undefined) {
|
|
3390
|
+
config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
|
|
3391
|
+
} else {
|
|
3392
|
+
config.allowAbsoluteUrls = true;
|
|
3393
|
+
}
|
|
3394
|
+
|
|
3275
3395
|
validator.assertOptions(config, {
|
|
3276
3396
|
baseUrl: validators.spelling('baseURL'),
|
|
3277
3397
|
withXsrfToken: validators.spelling('withXSRFToken')
|
|
@@ -3319,8 +3439,8 @@ class Axios$1 {
|
|
|
3319
3439
|
|
|
3320
3440
|
if (!synchronousRequestInterceptors) {
|
|
3321
3441
|
const chain = [dispatchRequest.bind(this), undefined];
|
|
3322
|
-
chain.unshift
|
|
3323
|
-
chain.push
|
|
3442
|
+
chain.unshift(...requestInterceptorChain);
|
|
3443
|
+
chain.push(...responseInterceptorChain);
|
|
3324
3444
|
len = chain.length;
|
|
3325
3445
|
|
|
3326
3446
|
promise = Promise.resolve(config);
|
|
@@ -3367,7 +3487,7 @@ class Axios$1 {
|
|
|
3367
3487
|
|
|
3368
3488
|
getUri(config) {
|
|
3369
3489
|
config = mergeConfig$1(this.defaults, config);
|
|
3370
|
-
const fullPath = buildFullPath(config.baseURL, config.url);
|
|
3490
|
+
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
|
|
3371
3491
|
return buildURL(fullPath, config.params, config.paramsSerializer);
|
|
3372
3492
|
}
|
|
3373
3493
|
}
|