@xchainjs/xchain-dash 2.2.2 → 2.2.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/lib/index.esm.js +1071 -759
- package/lib/index.js +1071 -759
- package/package.json +6 -6
package/lib/index.esm.js
CHANGED
|
@@ -169,7 +169,7 @@ const { isArray } = Array;
|
|
|
169
169
|
*
|
|
170
170
|
* @returns {boolean} True if the value is undefined, otherwise false
|
|
171
171
|
*/
|
|
172
|
-
const isUndefined = typeOfTest(
|
|
172
|
+
const isUndefined = typeOfTest('undefined');
|
|
173
173
|
|
|
174
174
|
/**
|
|
175
175
|
* Determine if a value is a Buffer
|
|
@@ -196,7 +196,7 @@ function isBuffer(val) {
|
|
|
196
196
|
*
|
|
197
197
|
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
|
198
198
|
*/
|
|
199
|
-
const isArrayBuffer = kindOfTest(
|
|
199
|
+
const isArrayBuffer = kindOfTest('ArrayBuffer');
|
|
200
200
|
|
|
201
201
|
/**
|
|
202
202
|
* Determine if a value is a view on an ArrayBuffer
|
|
@@ -207,7 +207,7 @@ const isArrayBuffer = kindOfTest("ArrayBuffer");
|
|
|
207
207
|
*/
|
|
208
208
|
function isArrayBufferView(val) {
|
|
209
209
|
let result;
|
|
210
|
-
if (typeof ArrayBuffer !==
|
|
210
|
+
if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
|
|
211
211
|
result = ArrayBuffer.isView(val);
|
|
212
212
|
} else {
|
|
213
213
|
result = val && val.buffer && isArrayBuffer(val.buffer);
|
|
@@ -222,7 +222,7 @@ function isArrayBufferView(val) {
|
|
|
222
222
|
*
|
|
223
223
|
* @returns {boolean} True if value is a String, otherwise false
|
|
224
224
|
*/
|
|
225
|
-
const isString = typeOfTest(
|
|
225
|
+
const isString = typeOfTest('string');
|
|
226
226
|
|
|
227
227
|
/**
|
|
228
228
|
* Determine if a value is a Function
|
|
@@ -230,7 +230,7 @@ const isString = typeOfTest("string");
|
|
|
230
230
|
* @param {*} val The value to test
|
|
231
231
|
* @returns {boolean} True if value is a Function, otherwise false
|
|
232
232
|
*/
|
|
233
|
-
const isFunction$1 = typeOfTest(
|
|
233
|
+
const isFunction$1 = typeOfTest('function');
|
|
234
234
|
|
|
235
235
|
/**
|
|
236
236
|
* Determine if a value is a Number
|
|
@@ -239,7 +239,7 @@ const isFunction$1 = typeOfTest("function");
|
|
|
239
239
|
*
|
|
240
240
|
* @returns {boolean} True if value is a Number, otherwise false
|
|
241
241
|
*/
|
|
242
|
-
const isNumber = typeOfTest(
|
|
242
|
+
const isNumber = typeOfTest('number');
|
|
243
243
|
|
|
244
244
|
/**
|
|
245
245
|
* Determine if a value is an Object
|
|
@@ -248,7 +248,7 @@ const isNumber = typeOfTest("number");
|
|
|
248
248
|
*
|
|
249
249
|
* @returns {boolean} True if value is an Object, otherwise false
|
|
250
250
|
*/
|
|
251
|
-
const isObject = (thing) => thing !== null && typeof thing ===
|
|
251
|
+
const isObject = (thing) => thing !== null && typeof thing === 'object';
|
|
252
252
|
|
|
253
253
|
/**
|
|
254
254
|
* Determine if a value is a Boolean
|
|
@@ -266,7 +266,7 @@ const isBoolean = (thing) => thing === true || thing === false;
|
|
|
266
266
|
* @returns {boolean} True if value is a plain Object, otherwise false
|
|
267
267
|
*/
|
|
268
268
|
const isPlainObject = (val) => {
|
|
269
|
-
if (kindOf(val) !==
|
|
269
|
+
if (kindOf(val) !== 'object') {
|
|
270
270
|
return false;
|
|
271
271
|
}
|
|
272
272
|
|
|
@@ -294,10 +294,7 @@ const isEmptyObject = (val) => {
|
|
|
294
294
|
}
|
|
295
295
|
|
|
296
296
|
try {
|
|
297
|
-
return (
|
|
298
|
-
Object.keys(val).length === 0 &&
|
|
299
|
-
Object.getPrototypeOf(val) === Object.prototype
|
|
300
|
-
);
|
|
297
|
+
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
|
301
298
|
} catch (e) {
|
|
302
299
|
// Fallback for any other objects that might cause RangeError with Object.keys()
|
|
303
300
|
return false;
|
|
@@ -311,7 +308,7 @@ const isEmptyObject = (val) => {
|
|
|
311
308
|
*
|
|
312
309
|
* @returns {boolean} True if value is a Date, otherwise false
|
|
313
310
|
*/
|
|
314
|
-
const isDate = kindOfTest(
|
|
311
|
+
const isDate = kindOfTest('Date');
|
|
315
312
|
|
|
316
313
|
/**
|
|
317
314
|
* Determine if a value is a File
|
|
@@ -320,7 +317,32 @@ const isDate = kindOfTest("Date");
|
|
|
320
317
|
*
|
|
321
318
|
* @returns {boolean} True if value is a File, otherwise false
|
|
322
319
|
*/
|
|
323
|
-
const isFile = kindOfTest(
|
|
320
|
+
const isFile = kindOfTest('File');
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Determine if a value is a React Native Blob
|
|
324
|
+
* React Native "blob": an object with a `uri` attribute. Optionally, it can
|
|
325
|
+
* also have a `name` and `type` attribute to specify filename and content type
|
|
326
|
+
*
|
|
327
|
+
* @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71
|
|
328
|
+
*
|
|
329
|
+
* @param {*} value The value to test
|
|
330
|
+
*
|
|
331
|
+
* @returns {boolean} True if value is a React Native Blob, otherwise false
|
|
332
|
+
*/
|
|
333
|
+
const isReactNativeBlob = (value) => {
|
|
334
|
+
return !!(value && typeof value.uri !== 'undefined');
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Determine if environment is React Native
|
|
339
|
+
* ReactNative `FormData` has a non-standard `getParts()` method
|
|
340
|
+
*
|
|
341
|
+
* @param {*} formData The formData to test
|
|
342
|
+
*
|
|
343
|
+
* @returns {boolean} True if environment is React Native, otherwise false
|
|
344
|
+
*/
|
|
345
|
+
const isReactNative = (formData) => formData && typeof formData.getParts !== 'undefined';
|
|
324
346
|
|
|
325
347
|
/**
|
|
326
348
|
* Determine if a value is a Blob
|
|
@@ -329,7 +351,7 @@ const isFile = kindOfTest("File");
|
|
|
329
351
|
*
|
|
330
352
|
* @returns {boolean} True if value is a Blob, otherwise false
|
|
331
353
|
*/
|
|
332
|
-
const isBlob = kindOfTest(
|
|
354
|
+
const isBlob = kindOfTest('Blob');
|
|
333
355
|
|
|
334
356
|
/**
|
|
335
357
|
* Determine if a value is a FileList
|
|
@@ -338,7 +360,7 @@ const isBlob = kindOfTest("Blob");
|
|
|
338
360
|
*
|
|
339
361
|
* @returns {boolean} True if value is a File, otherwise false
|
|
340
362
|
*/
|
|
341
|
-
const isFileList = kindOfTest(
|
|
363
|
+
const isFileList = kindOfTest('FileList');
|
|
342
364
|
|
|
343
365
|
/**
|
|
344
366
|
* Determine if a value is a Stream
|
|
@@ -356,17 +378,27 @@ const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
|
|
|
356
378
|
*
|
|
357
379
|
* @returns {boolean} True if value is an FormData, otherwise false
|
|
358
380
|
*/
|
|
381
|
+
function getGlobal() {
|
|
382
|
+
if (typeof globalThis !== 'undefined') return globalThis;
|
|
383
|
+
if (typeof self !== 'undefined') return self;
|
|
384
|
+
if (typeof window !== 'undefined') return window;
|
|
385
|
+
if (typeof global !== 'undefined') return global;
|
|
386
|
+
return {};
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
const G = getGlobal();
|
|
390
|
+
const FormDataCtor = typeof G.FormData !== 'undefined' ? G.FormData : undefined;
|
|
391
|
+
|
|
359
392
|
const isFormData = (thing) => {
|
|
360
393
|
let kind;
|
|
361
|
-
return (
|
|
362
|
-
thing
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
thing.toString() === "[object FormData]"))))
|
|
394
|
+
return thing && (
|
|
395
|
+
(FormDataCtor && thing instanceof FormDataCtor) || (
|
|
396
|
+
isFunction$1(thing.append) && (
|
|
397
|
+
(kind = kindOf(thing)) === 'formdata' ||
|
|
398
|
+
// detect form-data instance
|
|
399
|
+
(kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
|
|
400
|
+
)
|
|
401
|
+
)
|
|
370
402
|
);
|
|
371
403
|
};
|
|
372
404
|
|
|
@@ -377,13 +409,13 @@ const isFormData = (thing) => {
|
|
|
377
409
|
*
|
|
378
410
|
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
|
379
411
|
*/
|
|
380
|
-
const isURLSearchParams = kindOfTest(
|
|
412
|
+
const isURLSearchParams = kindOfTest('URLSearchParams');
|
|
381
413
|
|
|
382
414
|
const [isReadableStream, isRequest, isResponse, isHeaders] = [
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
415
|
+
'ReadableStream',
|
|
416
|
+
'Request',
|
|
417
|
+
'Response',
|
|
418
|
+
'Headers',
|
|
387
419
|
].map(kindOfTest);
|
|
388
420
|
|
|
389
421
|
/**
|
|
@@ -393,9 +425,9 @@ const [isReadableStream, isRequest, isResponse, isHeaders] = [
|
|
|
393
425
|
*
|
|
394
426
|
* @returns {String} The String freed of excess whitespace
|
|
395
427
|
*/
|
|
396
|
-
const trim = (str) =>
|
|
397
|
-
str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
|
|
398
|
-
|
|
428
|
+
const trim = (str) => {
|
|
429
|
+
return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
|
430
|
+
};
|
|
399
431
|
/**
|
|
400
432
|
* Iterate over an Array or an Object invoking a function for each item.
|
|
401
433
|
*
|
|
@@ -414,7 +446,7 @@ const trim = (str) =>
|
|
|
414
446
|
*/
|
|
415
447
|
function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
416
448
|
// Don't bother if no value provided
|
|
417
|
-
if (obj === null || typeof obj ===
|
|
449
|
+
if (obj === null || typeof obj === 'undefined') {
|
|
418
450
|
return;
|
|
419
451
|
}
|
|
420
452
|
|
|
@@ -422,7 +454,7 @@ function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
|
422
454
|
let l;
|
|
423
455
|
|
|
424
456
|
// Force an array if not already something iterable
|
|
425
|
-
if (typeof obj !==
|
|
457
|
+
if (typeof obj !== 'object') {
|
|
426
458
|
/*eslint no-param-reassign:0*/
|
|
427
459
|
obj = [obj];
|
|
428
460
|
}
|
|
@@ -439,9 +471,7 @@ function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
|
439
471
|
}
|
|
440
472
|
|
|
441
473
|
// Iterate over object keys
|
|
442
|
-
const keys = allOwnKeys
|
|
443
|
-
? Object.getOwnPropertyNames(obj)
|
|
444
|
-
: Object.keys(obj);
|
|
474
|
+
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
445
475
|
const len = keys.length;
|
|
446
476
|
let key;
|
|
447
477
|
|
|
@@ -452,6 +482,14 @@ function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
|
452
482
|
}
|
|
453
483
|
}
|
|
454
484
|
|
|
485
|
+
/**
|
|
486
|
+
* Finds a key in an object, case-insensitive, returning the actual key name.
|
|
487
|
+
* Returns null if the object is a Buffer or if no match is found.
|
|
488
|
+
*
|
|
489
|
+
* @param {Object} obj - The object to search.
|
|
490
|
+
* @param {string} key - The key to find (case-insensitive).
|
|
491
|
+
* @returns {?string} The actual key name if found, otherwise null.
|
|
492
|
+
*/
|
|
455
493
|
function findKey(obj, key) {
|
|
456
494
|
if (isBuffer(obj)) {
|
|
457
495
|
return null;
|
|
@@ -472,16 +510,11 @@ function findKey(obj, key) {
|
|
|
472
510
|
|
|
473
511
|
const _global = (() => {
|
|
474
512
|
/*eslint no-undef:0*/
|
|
475
|
-
if (typeof globalThis !==
|
|
476
|
-
return typeof self !==
|
|
477
|
-
? self
|
|
478
|
-
: typeof window !== "undefined"
|
|
479
|
-
? window
|
|
480
|
-
: global;
|
|
513
|
+
if (typeof globalThis !== 'undefined') return globalThis;
|
|
514
|
+
return typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : global;
|
|
481
515
|
})();
|
|
482
516
|
|
|
483
|
-
const isContextDefined = (context) =>
|
|
484
|
-
!isUndefined(context) && context !== _global;
|
|
517
|
+
const isContextDefined = (context) => !isUndefined(context) && context !== _global;
|
|
485
518
|
|
|
486
519
|
/**
|
|
487
520
|
* Accepts varargs expecting each argument to be an object, then
|
|
@@ -506,7 +539,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
506
539
|
const result = {};
|
|
507
540
|
const assignValue = (val, key) => {
|
|
508
541
|
// Skip dangerous property names to prevent prototype pollution
|
|
509
|
-
if (key ===
|
|
542
|
+
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
|
510
543
|
return;
|
|
511
544
|
}
|
|
512
545
|
|
|
@@ -559,7 +592,7 @@ const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
|
|
|
559
592
|
});
|
|
560
593
|
}
|
|
561
594
|
},
|
|
562
|
-
{ allOwnKeys }
|
|
595
|
+
{ allOwnKeys }
|
|
563
596
|
);
|
|
564
597
|
return a;
|
|
565
598
|
};
|
|
@@ -588,17 +621,14 @@ const stripBOM = (content) => {
|
|
|
588
621
|
* @returns {void}
|
|
589
622
|
*/
|
|
590
623
|
const inherits = (constructor, superConstructor, props, descriptors) => {
|
|
591
|
-
constructor.prototype = Object.create(
|
|
592
|
-
|
|
593
|
-
descriptors,
|
|
594
|
-
);
|
|
595
|
-
Object.defineProperty(constructor.prototype, "constructor", {
|
|
624
|
+
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
|
625
|
+
Object.defineProperty(constructor.prototype, 'constructor', {
|
|
596
626
|
value: constructor,
|
|
597
627
|
writable: true,
|
|
598
628
|
enumerable: false,
|
|
599
629
|
configurable: true,
|
|
600
630
|
});
|
|
601
|
-
Object.defineProperty(constructor,
|
|
631
|
+
Object.defineProperty(constructor, 'super', {
|
|
602
632
|
value: superConstructor.prototype,
|
|
603
633
|
});
|
|
604
634
|
props && Object.assign(constructor.prototype, props);
|
|
@@ -628,20 +658,13 @@ const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
|
|
|
628
658
|
i = props.length;
|
|
629
659
|
while (i-- > 0) {
|
|
630
660
|
prop = props[i];
|
|
631
|
-
if (
|
|
632
|
-
(!propFilter || propFilter(prop, sourceObj, destObj)) &&
|
|
633
|
-
!merged[prop]
|
|
634
|
-
) {
|
|
661
|
+
if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
|
|
635
662
|
destObj[prop] = sourceObj[prop];
|
|
636
663
|
merged[prop] = true;
|
|
637
664
|
}
|
|
638
665
|
}
|
|
639
666
|
sourceObj = filter !== false && getPrototypeOf(sourceObj);
|
|
640
|
-
} while (
|
|
641
|
-
sourceObj &&
|
|
642
|
-
(!filter || filter(sourceObj, destObj)) &&
|
|
643
|
-
sourceObj !== Object.prototype
|
|
644
|
-
);
|
|
667
|
+
} while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
|
645
668
|
|
|
646
669
|
return destObj;
|
|
647
670
|
};
|
|
@@ -698,7 +721,7 @@ const isTypedArray = ((TypedArray) => {
|
|
|
698
721
|
return (thing) => {
|
|
699
722
|
return TypedArray && thing instanceof TypedArray;
|
|
700
723
|
};
|
|
701
|
-
})(typeof Uint8Array !==
|
|
724
|
+
})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
|
|
702
725
|
|
|
703
726
|
/**
|
|
704
727
|
* For each entry in the object, call the function with the key and value.
|
|
@@ -741,14 +764,12 @@ const matchAll = (regExp, str) => {
|
|
|
741
764
|
};
|
|
742
765
|
|
|
743
766
|
/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
|
|
744
|
-
const isHTMLForm = kindOfTest(
|
|
767
|
+
const isHTMLForm = kindOfTest('HTMLFormElement');
|
|
745
768
|
|
|
746
769
|
const toCamelCase = (str) => {
|
|
747
|
-
return str
|
|
748
|
-
.
|
|
749
|
-
|
|
750
|
-
return p1.toUpperCase() + p2;
|
|
751
|
-
});
|
|
770
|
+
return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
|
|
771
|
+
return p1.toUpperCase() + p2;
|
|
772
|
+
});
|
|
752
773
|
};
|
|
753
774
|
|
|
754
775
|
/* Creating a function that will check if an object has a property. */
|
|
@@ -765,7 +786,7 @@ const hasOwnProperty = (
|
|
|
765
786
|
*
|
|
766
787
|
* @returns {boolean} True if value is a RegExp object, otherwise false
|
|
767
788
|
*/
|
|
768
|
-
const isRegExp = kindOfTest(
|
|
789
|
+
const isRegExp = kindOfTest('RegExp');
|
|
769
790
|
|
|
770
791
|
const reduceDescriptors = (obj, reducer) => {
|
|
771
792
|
const descriptors = Object.getOwnPropertyDescriptors(obj);
|
|
@@ -789,10 +810,7 @@ const reduceDescriptors = (obj, reducer) => {
|
|
|
789
810
|
const freezeMethods = (obj) => {
|
|
790
811
|
reduceDescriptors(obj, (descriptor, name) => {
|
|
791
812
|
// skip restricted props in strict mode
|
|
792
|
-
if (
|
|
793
|
-
isFunction$1(obj) &&
|
|
794
|
-
["arguments", "caller", "callee"].indexOf(name) !== -1
|
|
795
|
-
) {
|
|
813
|
+
if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
|
796
814
|
return false;
|
|
797
815
|
}
|
|
798
816
|
|
|
@@ -802,7 +820,7 @@ const freezeMethods = (obj) => {
|
|
|
802
820
|
|
|
803
821
|
descriptor.enumerable = false;
|
|
804
822
|
|
|
805
|
-
if (
|
|
823
|
+
if ('writable' in descriptor) {
|
|
806
824
|
descriptor.writable = false;
|
|
807
825
|
return;
|
|
808
826
|
}
|
|
@@ -815,6 +833,14 @@ const freezeMethods = (obj) => {
|
|
|
815
833
|
});
|
|
816
834
|
};
|
|
817
835
|
|
|
836
|
+
/**
|
|
837
|
+
* Converts an array or a delimited string into an object set with values as keys and true as values.
|
|
838
|
+
* Useful for fast membership checks.
|
|
839
|
+
*
|
|
840
|
+
* @param {Array|string} arrayOrString - The array or string to convert.
|
|
841
|
+
* @param {string} delimiter - The delimiter to use if input is a string.
|
|
842
|
+
* @returns {Object} An object with keys from the array or string, values set to true.
|
|
843
|
+
*/
|
|
818
844
|
const toObjectSet = (arrayOrString, delimiter) => {
|
|
819
845
|
const obj = {};
|
|
820
846
|
|
|
@@ -824,9 +850,7 @@ const toObjectSet = (arrayOrString, delimiter) => {
|
|
|
824
850
|
});
|
|
825
851
|
};
|
|
826
852
|
|
|
827
|
-
isArray(arrayOrString)
|
|
828
|
-
? define(arrayOrString)
|
|
829
|
-
: define(String(arrayOrString).split(delimiter));
|
|
853
|
+
isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
|
|
830
854
|
|
|
831
855
|
return obj;
|
|
832
856
|
};
|
|
@@ -834,9 +858,7 @@ const toObjectSet = (arrayOrString, delimiter) => {
|
|
|
834
858
|
const noop = () => {};
|
|
835
859
|
|
|
836
860
|
const toFiniteNumber = (value, defaultValue) => {
|
|
837
|
-
return value != null && Number.isFinite((value = +value))
|
|
838
|
-
? value
|
|
839
|
-
: defaultValue;
|
|
861
|
+
return value != null && Number.isFinite((value = +value)) ? value : defaultValue;
|
|
840
862
|
};
|
|
841
863
|
|
|
842
864
|
/**
|
|
@@ -850,11 +872,17 @@ function isSpecCompliantForm(thing) {
|
|
|
850
872
|
return !!(
|
|
851
873
|
thing &&
|
|
852
874
|
isFunction$1(thing.append) &&
|
|
853
|
-
thing[toStringTag] ===
|
|
875
|
+
thing[toStringTag] === 'FormData' &&
|
|
854
876
|
thing[iterator]
|
|
855
877
|
);
|
|
856
878
|
}
|
|
857
879
|
|
|
880
|
+
/**
|
|
881
|
+
* Recursively converts an object to a JSON-compatible object, handling circular references and Buffers.
|
|
882
|
+
*
|
|
883
|
+
* @param {Object} obj - The object to convert.
|
|
884
|
+
* @returns {Object} The JSON-compatible object.
|
|
885
|
+
*/
|
|
858
886
|
const toJSONObject = (obj) => {
|
|
859
887
|
const stack = new Array(10);
|
|
860
888
|
|
|
@@ -869,7 +897,7 @@ const toJSONObject = (obj) => {
|
|
|
869
897
|
return source;
|
|
870
898
|
}
|
|
871
899
|
|
|
872
|
-
if (!(
|
|
900
|
+
if (!('toJSON' in source)) {
|
|
873
901
|
stack[i] = source;
|
|
874
902
|
const target = isArray(source) ? [] : {};
|
|
875
903
|
|
|
@@ -890,8 +918,20 @@ const toJSONObject = (obj) => {
|
|
|
890
918
|
return visit(obj, 0);
|
|
891
919
|
};
|
|
892
920
|
|
|
893
|
-
|
|
921
|
+
/**
|
|
922
|
+
* Determines if a value is an async function.
|
|
923
|
+
*
|
|
924
|
+
* @param {*} thing - The value to test.
|
|
925
|
+
* @returns {boolean} True if value is an async function, otherwise false.
|
|
926
|
+
*/
|
|
927
|
+
const isAsyncFn = kindOfTest('AsyncFunction');
|
|
894
928
|
|
|
929
|
+
/**
|
|
930
|
+
* Determines if a value is thenable (has then and catch methods).
|
|
931
|
+
*
|
|
932
|
+
* @param {*} thing - The value to test.
|
|
933
|
+
* @returns {boolean} True if value is thenable, otherwise false.
|
|
934
|
+
*/
|
|
895
935
|
const isThenable = (thing) =>
|
|
896
936
|
thing &&
|
|
897
937
|
(isObject(thing) || isFunction$1(thing)) &&
|
|
@@ -901,6 +941,14 @@ const isThenable = (thing) =>
|
|
|
901
941
|
// original code
|
|
902
942
|
// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
|
|
903
943
|
|
|
944
|
+
/**
|
|
945
|
+
* Provides a cross-platform setImmediate implementation.
|
|
946
|
+
* Uses native setImmediate if available, otherwise falls back to postMessage or setTimeout.
|
|
947
|
+
*
|
|
948
|
+
* @param {boolean} setImmediateSupported - Whether setImmediate is supported.
|
|
949
|
+
* @param {boolean} postMessageSupported - Whether postMessage is supported.
|
|
950
|
+
* @returns {Function} A function to schedule a callback asynchronously.
|
|
951
|
+
*/
|
|
904
952
|
const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
905
953
|
if (setImmediateSupported) {
|
|
906
954
|
return setImmediate;
|
|
@@ -909,27 +957,33 @@ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
|
909
957
|
return postMessageSupported
|
|
910
958
|
? ((token, callbacks) => {
|
|
911
959
|
_global.addEventListener(
|
|
912
|
-
|
|
960
|
+
'message',
|
|
913
961
|
({ source, data }) => {
|
|
914
962
|
if (source === _global && data === token) {
|
|
915
963
|
callbacks.length && callbacks.shift()();
|
|
916
964
|
}
|
|
917
965
|
},
|
|
918
|
-
false
|
|
966
|
+
false
|
|
919
967
|
);
|
|
920
968
|
|
|
921
969
|
return (cb) => {
|
|
922
970
|
callbacks.push(cb);
|
|
923
|
-
_global.postMessage(token,
|
|
971
|
+
_global.postMessage(token, '*');
|
|
924
972
|
};
|
|
925
973
|
})(`axios@${Math.random()}`, [])
|
|
926
974
|
: (cb) => setTimeout(cb);
|
|
927
|
-
})(typeof setImmediate ===
|
|
975
|
+
})(typeof setImmediate === 'function', isFunction$1(_global.postMessage));
|
|
928
976
|
|
|
977
|
+
/**
|
|
978
|
+
* Schedules a microtask or asynchronous callback as soon as possible.
|
|
979
|
+
* Uses queueMicrotask if available, otherwise falls back to process.nextTick or _setImmediate.
|
|
980
|
+
*
|
|
981
|
+
* @type {Function}
|
|
982
|
+
*/
|
|
929
983
|
const asap =
|
|
930
|
-
typeof queueMicrotask !==
|
|
984
|
+
typeof queueMicrotask !== 'undefined'
|
|
931
985
|
? queueMicrotask.bind(_global)
|
|
932
|
-
: (typeof process !==
|
|
986
|
+
: (typeof process !== 'undefined' && process.nextTick) || _setImmediate;
|
|
933
987
|
|
|
934
988
|
// *********************
|
|
935
989
|
|
|
@@ -954,6 +1008,8 @@ var utils$1 = {
|
|
|
954
1008
|
isUndefined,
|
|
955
1009
|
isDate,
|
|
956
1010
|
isFile,
|
|
1011
|
+
isReactNativeBlob,
|
|
1012
|
+
isReactNative,
|
|
957
1013
|
isBlob,
|
|
958
1014
|
isRegExp,
|
|
959
1015
|
isFunction: isFunction$1,
|
|
@@ -996,14 +1052,20 @@ var utils$1 = {
|
|
|
996
1052
|
};
|
|
997
1053
|
|
|
998
1054
|
let AxiosError$1 = class AxiosError extends Error {
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1055
|
+
static from(error, code, config, request, response, customProps) {
|
|
1056
|
+
const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
|
|
1057
|
+
axiosError.cause = error;
|
|
1058
|
+
axiosError.name = error.name;
|
|
1059
|
+
|
|
1060
|
+
// Preserve status from the original error if not already set from response
|
|
1061
|
+
if (error.status != null && axiosError.status == null) {
|
|
1062
|
+
axiosError.status = error.status;
|
|
1005
1063
|
}
|
|
1006
1064
|
|
|
1065
|
+
customProps && Object.assign(axiosError, customProps);
|
|
1066
|
+
return axiosError;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1007
1069
|
/**
|
|
1008
1070
|
* Create an Error with the specified message, config, error code, request and response.
|
|
1009
1071
|
*
|
|
@@ -1016,37 +1078,48 @@ let AxiosError$1 = class AxiosError extends Error {
|
|
|
1016
1078
|
* @returns {Error} The created error.
|
|
1017
1079
|
*/
|
|
1018
1080
|
constructor(message, code, config, request, response) {
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1081
|
+
super(message);
|
|
1082
|
+
|
|
1083
|
+
// Make message enumerable to maintain backward compatibility
|
|
1084
|
+
// The native Error constructor sets message as non-enumerable,
|
|
1085
|
+
// but axios < v1.13.3 had it as enumerable
|
|
1086
|
+
Object.defineProperty(this, 'message', {
|
|
1087
|
+
value: message,
|
|
1088
|
+
enumerable: true,
|
|
1089
|
+
writable: true,
|
|
1090
|
+
configurable: true
|
|
1091
|
+
});
|
|
1092
|
+
|
|
1093
|
+
this.name = 'AxiosError';
|
|
1094
|
+
this.isAxiosError = true;
|
|
1095
|
+
code && (this.code = code);
|
|
1096
|
+
config && (this.config = config);
|
|
1097
|
+
request && (this.request = request);
|
|
1098
|
+
if (response) {
|
|
1099
|
+
this.response = response;
|
|
1100
|
+
this.status = response.status;
|
|
1101
|
+
}
|
|
1029
1102
|
}
|
|
1030
1103
|
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1104
|
+
toJSON() {
|
|
1105
|
+
return {
|
|
1106
|
+
// Standard
|
|
1107
|
+
message: this.message,
|
|
1108
|
+
name: this.name,
|
|
1109
|
+
// Microsoft
|
|
1110
|
+
description: this.description,
|
|
1111
|
+
number: this.number,
|
|
1112
|
+
// Mozilla
|
|
1113
|
+
fileName: this.fileName,
|
|
1114
|
+
lineNumber: this.lineNumber,
|
|
1115
|
+
columnNumber: this.columnNumber,
|
|
1116
|
+
stack: this.stack,
|
|
1117
|
+
// Axios
|
|
1118
|
+
config: utils$1.toJSONObject(this.config),
|
|
1119
|
+
code: this.code,
|
|
1120
|
+
status: this.status,
|
|
1121
|
+
};
|
|
1122
|
+
}
|
|
1050
1123
|
};
|
|
1051
1124
|
|
|
1052
1125
|
// This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
|
|
@@ -1099,11 +1172,14 @@ function removeBrackets(key) {
|
|
|
1099
1172
|
*/
|
|
1100
1173
|
function renderKey(path, key, dots) {
|
|
1101
1174
|
if (!path) return key;
|
|
1102
|
-
return path
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1175
|
+
return path
|
|
1176
|
+
.concat(key)
|
|
1177
|
+
.map(function each(token, i) {
|
|
1178
|
+
// eslint-disable-next-line no-param-reassign
|
|
1179
|
+
token = removeBrackets(token);
|
|
1180
|
+
return !dots && i ? '[' + token + ']' : token;
|
|
1181
|
+
})
|
|
1182
|
+
.join(dots ? '.' : '');
|
|
1107
1183
|
}
|
|
1108
1184
|
|
|
1109
1185
|
/**
|
|
@@ -1153,21 +1229,26 @@ function toFormData$1(obj, formData, options) {
|
|
|
1153
1229
|
formData = formData || new (FormData)();
|
|
1154
1230
|
|
|
1155
1231
|
// eslint-disable-next-line no-param-reassign
|
|
1156
|
-
options = utils$1.toFlatObject(
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1232
|
+
options = utils$1.toFlatObject(
|
|
1233
|
+
options,
|
|
1234
|
+
{
|
|
1235
|
+
metaTokens: true,
|
|
1236
|
+
dots: false,
|
|
1237
|
+
indexes: false,
|
|
1238
|
+
},
|
|
1239
|
+
false,
|
|
1240
|
+
function defined(option, source) {
|
|
1241
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
1242
|
+
return !utils$1.isUndefined(source[option]);
|
|
1243
|
+
}
|
|
1244
|
+
);
|
|
1164
1245
|
|
|
1165
1246
|
const metaTokens = options.metaTokens;
|
|
1166
1247
|
// eslint-disable-next-line no-use-before-define
|
|
1167
1248
|
const visitor = options.visitor || defaultVisitor;
|
|
1168
1249
|
const dots = options.dots;
|
|
1169
1250
|
const indexes = options.indexes;
|
|
1170
|
-
const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
|
|
1251
|
+
const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
|
|
1171
1252
|
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
|
|
1172
1253
|
|
|
1173
1254
|
if (!utils$1.isFunction(visitor)) {
|
|
@@ -1209,6 +1290,11 @@ function toFormData$1(obj, formData, options) {
|
|
|
1209
1290
|
function defaultVisitor(value, key, path) {
|
|
1210
1291
|
let arr = value;
|
|
1211
1292
|
|
|
1293
|
+
if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
|
|
1294
|
+
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
1295
|
+
return false;
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1212
1298
|
if (value && !path && typeof value === 'object') {
|
|
1213
1299
|
if (utils$1.endsWith(key, '{}')) {
|
|
1214
1300
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -1217,17 +1303,22 @@ function toFormData$1(obj, formData, options) {
|
|
|
1217
1303
|
value = JSON.stringify(value);
|
|
1218
1304
|
} else if (
|
|
1219
1305
|
(utils$1.isArray(value) && isFlatArray(value)) ||
|
|
1220
|
-
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
|
|
1221
|
-
|
|
1306
|
+
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
|
|
1307
|
+
) {
|
|
1222
1308
|
// eslint-disable-next-line no-param-reassign
|
|
1223
1309
|
key = removeBrackets(key);
|
|
1224
1310
|
|
|
1225
1311
|
arr.forEach(function each(el, index) {
|
|
1226
|
-
!(utils$1.isUndefined(el) || el === null) &&
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1312
|
+
!(utils$1.isUndefined(el) || el === null) &&
|
|
1313
|
+
formData.append(
|
|
1314
|
+
// eslint-disable-next-line no-nested-ternary
|
|
1315
|
+
indexes === true
|
|
1316
|
+
? renderKey([key], index, dots)
|
|
1317
|
+
: indexes === null
|
|
1318
|
+
? key
|
|
1319
|
+
: key + '[]',
|
|
1320
|
+
convertValue(el)
|
|
1321
|
+
);
|
|
1231
1322
|
});
|
|
1232
1323
|
return false;
|
|
1233
1324
|
}
|
|
@@ -1247,7 +1338,7 @@ function toFormData$1(obj, formData, options) {
|
|
|
1247
1338
|
const exposedHelpers = Object.assign(predicates, {
|
|
1248
1339
|
defaultVisitor,
|
|
1249
1340
|
convertValue,
|
|
1250
|
-
isVisitable
|
|
1341
|
+
isVisitable,
|
|
1251
1342
|
});
|
|
1252
1343
|
|
|
1253
1344
|
function build(value, path) {
|
|
@@ -1260,9 +1351,9 @@ function toFormData$1(obj, formData, options) {
|
|
|
1260
1351
|
stack.push(value);
|
|
1261
1352
|
|
|
1262
1353
|
utils$1.forEach(value, function each(el, key) {
|
|
1263
|
-
const result =
|
|
1264
|
-
|
|
1265
|
-
|
|
1354
|
+
const result =
|
|
1355
|
+
!(utils$1.isUndefined(el) || el === null) &&
|
|
1356
|
+
visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
|
|
1266
1357
|
|
|
1267
1358
|
if (result === true) {
|
|
1268
1359
|
build(el, path ? path.concat(key) : [key]);
|
|
@@ -1297,7 +1388,7 @@ function encode$1(str) {
|
|
|
1297
1388
|
')': '%29',
|
|
1298
1389
|
'~': '%7E',
|
|
1299
1390
|
'%20': '+',
|
|
1300
|
-
'%00': '\x00'
|
|
1391
|
+
'%00': '\x00',
|
|
1301
1392
|
};
|
|
1302
1393
|
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
|
1303
1394
|
return charMap[match];
|
|
@@ -1325,29 +1416,33 @@ prototype.append = function append(name, value) {
|
|
|
1325
1416
|
};
|
|
1326
1417
|
|
|
1327
1418
|
prototype.toString = function toString(encoder) {
|
|
1328
|
-
const _encode = encoder
|
|
1329
|
-
|
|
1330
|
-
|
|
1419
|
+
const _encode = encoder
|
|
1420
|
+
? function (value) {
|
|
1421
|
+
return encoder.call(this, value, encode$1);
|
|
1422
|
+
}
|
|
1423
|
+
: encode$1;
|
|
1331
1424
|
|
|
1332
|
-
return this._pairs
|
|
1333
|
-
|
|
1334
|
-
|
|
1425
|
+
return this._pairs
|
|
1426
|
+
.map(function each(pair) {
|
|
1427
|
+
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
|
1428
|
+
}, '')
|
|
1429
|
+
.join('&');
|
|
1335
1430
|
};
|
|
1336
1431
|
|
|
1337
1432
|
/**
|
|
1338
|
-
* It replaces
|
|
1339
|
-
*
|
|
1433
|
+
* It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
|
|
1434
|
+
* their plain counterparts (`:`, `$`, `,`, `+`).
|
|
1340
1435
|
*
|
|
1341
1436
|
* @param {string} val The value to be encoded.
|
|
1342
1437
|
*
|
|
1343
1438
|
* @returns {string} The encoded value.
|
|
1344
1439
|
*/
|
|
1345
1440
|
function encode(val) {
|
|
1346
|
-
return encodeURIComponent(val)
|
|
1347
|
-
replace(/%3A/gi, ':')
|
|
1348
|
-
replace(/%24/g, '$')
|
|
1349
|
-
replace(/%2C/gi, ',')
|
|
1350
|
-
replace(/%20/g, '+');
|
|
1441
|
+
return encodeURIComponent(val)
|
|
1442
|
+
.replace(/%3A/gi, ':')
|
|
1443
|
+
.replace(/%24/g, '$')
|
|
1444
|
+
.replace(/%2C/gi, ',')
|
|
1445
|
+
.replace(/%20/g, '+');
|
|
1351
1446
|
}
|
|
1352
1447
|
|
|
1353
1448
|
/**
|
|
@@ -1364,11 +1459,13 @@ function buildURL(url, params, options) {
|
|
|
1364
1459
|
return url;
|
|
1365
1460
|
}
|
|
1366
1461
|
|
|
1367
|
-
const _encode = options && options.encode || encode;
|
|
1462
|
+
const _encode = (options && options.encode) || encode;
|
|
1368
1463
|
|
|
1369
|
-
const _options = utils$1.isFunction(options)
|
|
1370
|
-
|
|
1371
|
-
|
|
1464
|
+
const _options = utils$1.isFunction(options)
|
|
1465
|
+
? {
|
|
1466
|
+
serialize: options,
|
|
1467
|
+
}
|
|
1468
|
+
: options;
|
|
1372
1469
|
|
|
1373
1470
|
const serializeFn = _options && _options.serialize;
|
|
1374
1471
|
|
|
@@ -1377,13 +1474,13 @@ function buildURL(url, params, options) {
|
|
|
1377
1474
|
if (serializeFn) {
|
|
1378
1475
|
serializedParams = serializeFn(params, _options);
|
|
1379
1476
|
} else {
|
|
1380
|
-
serializedParams = utils$1.isURLSearchParams(params)
|
|
1381
|
-
params.toString()
|
|
1382
|
-
new AxiosURLSearchParams(params, _options).toString(_encode);
|
|
1477
|
+
serializedParams = utils$1.isURLSearchParams(params)
|
|
1478
|
+
? params.toString()
|
|
1479
|
+
: new AxiosURLSearchParams(params, _options).toString(_encode);
|
|
1383
1480
|
}
|
|
1384
1481
|
|
|
1385
1482
|
if (serializedParams) {
|
|
1386
|
-
const hashmarkIndex = url.indexOf(
|
|
1483
|
+
const hashmarkIndex = url.indexOf('#');
|
|
1387
1484
|
|
|
1388
1485
|
if (hashmarkIndex !== -1) {
|
|
1389
1486
|
url = url.slice(0, hashmarkIndex);
|
|
@@ -1413,7 +1510,7 @@ class InterceptorManager {
|
|
|
1413
1510
|
fulfilled,
|
|
1414
1511
|
rejected,
|
|
1415
1512
|
synchronous: options ? options.synchronous : false,
|
|
1416
|
-
runWhen: options ? options.runWhen : null
|
|
1513
|
+
runWhen: options ? options.runWhen : null,
|
|
1417
1514
|
});
|
|
1418
1515
|
return this.handlers.length - 1;
|
|
1419
1516
|
}
|
|
@@ -1465,7 +1562,7 @@ var transitionalDefaults = {
|
|
|
1465
1562
|
silentJSONParsing: true,
|
|
1466
1563
|
forcedJSONParsing: true,
|
|
1467
1564
|
clarifyTimeoutError: false,
|
|
1468
|
-
legacyInterceptorReqResOrdering: true
|
|
1565
|
+
legacyInterceptorReqResOrdering: true,
|
|
1469
1566
|
};
|
|
1470
1567
|
|
|
1471
1568
|
var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
|
|
@@ -1479,14 +1576,14 @@ var platform$1 = {
|
|
|
1479
1576
|
classes: {
|
|
1480
1577
|
URLSearchParams: URLSearchParams$1,
|
|
1481
1578
|
FormData: FormData$1,
|
|
1482
|
-
Blob: Blob$1
|
|
1579
|
+
Blob: Blob$1,
|
|
1483
1580
|
},
|
|
1484
|
-
protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
|
|
1581
|
+
protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],
|
|
1485
1582
|
};
|
|
1486
1583
|
|
|
1487
1584
|
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
1488
1585
|
|
|
1489
|
-
const _navigator = typeof navigator === 'object' && navigator || undefined;
|
|
1586
|
+
const _navigator = (typeof navigator === 'object' && navigator) || undefined;
|
|
1490
1587
|
|
|
1491
1588
|
/**
|
|
1492
1589
|
* Determine if we're running in a standard browser environment
|
|
@@ -1505,7 +1602,8 @@ const _navigator = typeof navigator === 'object' && navigator || undefined;
|
|
|
1505
1602
|
*
|
|
1506
1603
|
* @returns {boolean}
|
|
1507
1604
|
*/
|
|
1508
|
-
const hasStandardBrowserEnv =
|
|
1605
|
+
const hasStandardBrowserEnv =
|
|
1606
|
+
hasBrowserEnv &&
|
|
1509
1607
|
(!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
|
|
1510
1608
|
|
|
1511
1609
|
/**
|
|
@@ -1526,7 +1624,7 @@ const hasStandardBrowserWebWorkerEnv = (() => {
|
|
|
1526
1624
|
);
|
|
1527
1625
|
})();
|
|
1528
1626
|
|
|
1529
|
-
const origin = hasBrowserEnv && window.location.href || 'http://localhost';
|
|
1627
|
+
const origin = (hasBrowserEnv && window.location.href) || 'http://localhost';
|
|
1530
1628
|
|
|
1531
1629
|
var utils = /*#__PURE__*/Object.freeze({
|
|
1532
1630
|
__proto__: null,
|
|
@@ -1539,12 +1637,12 @@ var utils = /*#__PURE__*/Object.freeze({
|
|
|
1539
1637
|
|
|
1540
1638
|
var platform = {
|
|
1541
1639
|
...utils,
|
|
1542
|
-
...platform$1
|
|
1640
|
+
...platform$1,
|
|
1543
1641
|
};
|
|
1544
1642
|
|
|
1545
1643
|
function toURLEncodedForm(data, options) {
|
|
1546
1644
|
return toFormData$1(data, new platform.classes.URLSearchParams(), {
|
|
1547
|
-
visitor: function(value, key, path, helpers) {
|
|
1645
|
+
visitor: function (value, key, path, helpers) {
|
|
1548
1646
|
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
1549
1647
|
this.append(key, value.toString('base64'));
|
|
1550
1648
|
return false;
|
|
@@ -1552,7 +1650,7 @@ function toURLEncodedForm(data, options) {
|
|
|
1552
1650
|
|
|
1553
1651
|
return helpers.defaultVisitor.apply(this, arguments);
|
|
1554
1652
|
},
|
|
1555
|
-
...options
|
|
1653
|
+
...options,
|
|
1556
1654
|
});
|
|
1557
1655
|
}
|
|
1558
1656
|
|
|
@@ -1568,7 +1666,7 @@ function parsePropPath(name) {
|
|
|
1568
1666
|
// foo.x.y.z
|
|
1569
1667
|
// foo-x-y-z
|
|
1570
1668
|
// foo x y z
|
|
1571
|
-
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
|
|
1669
|
+
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
|
|
1572
1670
|
return match[0] === '[]' ? '' : match[1] || match[0];
|
|
1573
1671
|
});
|
|
1574
1672
|
}
|
|
@@ -1672,96 +1770,107 @@ function stringifySafely(rawValue, parser, encoder) {
|
|
|
1672
1770
|
}
|
|
1673
1771
|
|
|
1674
1772
|
const defaults = {
|
|
1675
|
-
|
|
1676
1773
|
transitional: transitionalDefaults,
|
|
1677
1774
|
|
|
1678
1775
|
adapter: ['xhr', 'http', 'fetch'],
|
|
1679
1776
|
|
|
1680
|
-
transformRequest: [
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1777
|
+
transformRequest: [
|
|
1778
|
+
function transformRequest(data, headers) {
|
|
1779
|
+
const contentType = headers.getContentType() || '';
|
|
1780
|
+
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
|
1781
|
+
const isObjectPayload = utils$1.isObject(data);
|
|
1684
1782
|
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1783
|
+
if (isObjectPayload && utils$1.isHTMLForm(data)) {
|
|
1784
|
+
data = new FormData(data);
|
|
1785
|
+
}
|
|
1688
1786
|
|
|
1689
|
-
|
|
1787
|
+
const isFormData = utils$1.isFormData(data);
|
|
1690
1788
|
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1789
|
+
if (isFormData) {
|
|
1790
|
+
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
1791
|
+
}
|
|
1694
1792
|
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1793
|
+
if (
|
|
1794
|
+
utils$1.isArrayBuffer(data) ||
|
|
1795
|
+
utils$1.isBuffer(data) ||
|
|
1796
|
+
utils$1.isStream(data) ||
|
|
1797
|
+
utils$1.isFile(data) ||
|
|
1798
|
+
utils$1.isBlob(data) ||
|
|
1799
|
+
utils$1.isReadableStream(data)
|
|
1800
|
+
) {
|
|
1801
|
+
return data;
|
|
1802
|
+
}
|
|
1803
|
+
if (utils$1.isArrayBufferView(data)) {
|
|
1804
|
+
return data.buffer;
|
|
1805
|
+
}
|
|
1806
|
+
if (utils$1.isURLSearchParams(data)) {
|
|
1807
|
+
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
|
1808
|
+
return data.toString();
|
|
1809
|
+
}
|
|
1711
1810
|
|
|
1712
|
-
|
|
1811
|
+
let isFileList;
|
|
1713
1812
|
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1813
|
+
if (isObjectPayload) {
|
|
1814
|
+
if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
|
|
1815
|
+
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
1816
|
+
}
|
|
1718
1817
|
|
|
1719
|
-
|
|
1720
|
-
|
|
1818
|
+
if (
|
|
1819
|
+
(isFileList = utils$1.isFileList(data)) ||
|
|
1820
|
+
contentType.indexOf('multipart/form-data') > -1
|
|
1821
|
+
) {
|
|
1822
|
+
const _FormData = this.env && this.env.FormData;
|
|
1721
1823
|
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1824
|
+
return toFormData$1(
|
|
1825
|
+
isFileList ? { 'files[]': data } : data,
|
|
1826
|
+
_FormData && new _FormData(),
|
|
1827
|
+
this.formSerializer
|
|
1828
|
+
);
|
|
1829
|
+
}
|
|
1727
1830
|
}
|
|
1728
|
-
}
|
|
1729
1831
|
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1832
|
+
if (isObjectPayload || hasJSONContentType) {
|
|
1833
|
+
headers.setContentType('application/json', false);
|
|
1834
|
+
return stringifySafely(data);
|
|
1835
|
+
}
|
|
1734
1836
|
|
|
1735
|
-
|
|
1736
|
-
|
|
1837
|
+
return data;
|
|
1838
|
+
},
|
|
1839
|
+
],
|
|
1737
1840
|
|
|
1738
|
-
transformResponse: [
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1841
|
+
transformResponse: [
|
|
1842
|
+
function transformResponse(data) {
|
|
1843
|
+
const transitional = this.transitional || defaults.transitional;
|
|
1844
|
+
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
1845
|
+
const JSONRequested = this.responseType === 'json';
|
|
1742
1846
|
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1847
|
+
if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
|
|
1848
|
+
return data;
|
|
1849
|
+
}
|
|
1746
1850
|
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1851
|
+
if (
|
|
1852
|
+
data &&
|
|
1853
|
+
utils$1.isString(data) &&
|
|
1854
|
+
((forcedJSONParsing && !this.responseType) || JSONRequested)
|
|
1855
|
+
) {
|
|
1856
|
+
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
1857
|
+
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
1750
1858
|
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1859
|
+
try {
|
|
1860
|
+
return JSON.parse(data, this.parseReviver);
|
|
1861
|
+
} catch (e) {
|
|
1862
|
+
if (strictJSONParsing) {
|
|
1863
|
+
if (e.name === 'SyntaxError') {
|
|
1864
|
+
throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
|
|
1865
|
+
}
|
|
1866
|
+
throw e;
|
|
1757
1867
|
}
|
|
1758
|
-
throw e;
|
|
1759
1868
|
}
|
|
1760
1869
|
}
|
|
1761
|
-
}
|
|
1762
1870
|
|
|
1763
|
-
|
|
1764
|
-
|
|
1871
|
+
return data;
|
|
1872
|
+
},
|
|
1873
|
+
],
|
|
1765
1874
|
|
|
1766
1875
|
/**
|
|
1767
1876
|
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
@@ -1777,7 +1886,7 @@ const defaults = {
|
|
|
1777
1886
|
|
|
1778
1887
|
env: {
|
|
1779
1888
|
FormData: platform.classes.FormData,
|
|
1780
|
-
Blob: platform.classes.Blob
|
|
1889
|
+
Blob: platform.classes.Blob,
|
|
1781
1890
|
},
|
|
1782
1891
|
|
|
1783
1892
|
validateStatus: function validateStatus(status) {
|
|
@@ -1786,10 +1895,10 @@ const defaults = {
|
|
|
1786
1895
|
|
|
1787
1896
|
headers: {
|
|
1788
1897
|
common: {
|
|
1789
|
-
|
|
1790
|
-
'Content-Type': undefined
|
|
1791
|
-
}
|
|
1792
|
-
}
|
|
1898
|
+
Accept: 'application/json, text/plain, */*',
|
|
1899
|
+
'Content-Type': undefined,
|
|
1900
|
+
},
|
|
1901
|
+
},
|
|
1793
1902
|
};
|
|
1794
1903
|
|
|
1795
1904
|
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
|
|
@@ -1799,10 +1908,23 @@ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
|
|
|
1799
1908
|
// RawAxiosHeaders whose duplicates are ignored by node
|
|
1800
1909
|
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
1801
1910
|
const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
1802
|
-
'age',
|
|
1803
|
-
'
|
|
1804
|
-
'
|
|
1805
|
-
'
|
|
1911
|
+
'age',
|
|
1912
|
+
'authorization',
|
|
1913
|
+
'content-length',
|
|
1914
|
+
'content-type',
|
|
1915
|
+
'etag',
|
|
1916
|
+
'expires',
|
|
1917
|
+
'from',
|
|
1918
|
+
'host',
|
|
1919
|
+
'if-modified-since',
|
|
1920
|
+
'if-unmodified-since',
|
|
1921
|
+
'last-modified',
|
|
1922
|
+
'location',
|
|
1923
|
+
'max-forwards',
|
|
1924
|
+
'proxy-authorization',
|
|
1925
|
+
'referer',
|
|
1926
|
+
'retry-after',
|
|
1927
|
+
'user-agent',
|
|
1806
1928
|
]);
|
|
1807
1929
|
|
|
1808
1930
|
/**
|
|
@@ -1819,47 +1941,81 @@ const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
|
1819
1941
|
*
|
|
1820
1942
|
* @returns {Object} Headers parsed into an object
|
|
1821
1943
|
*/
|
|
1822
|
-
var parseHeaders = rawHeaders => {
|
|
1944
|
+
var parseHeaders = (rawHeaders) => {
|
|
1823
1945
|
const parsed = {};
|
|
1824
1946
|
let key;
|
|
1825
1947
|
let val;
|
|
1826
1948
|
let i;
|
|
1827
1949
|
|
|
1828
|
-
rawHeaders &&
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1950
|
+
rawHeaders &&
|
|
1951
|
+
rawHeaders.split('\n').forEach(function parser(line) {
|
|
1952
|
+
i = line.indexOf(':');
|
|
1953
|
+
key = line.substring(0, i).trim().toLowerCase();
|
|
1954
|
+
val = line.substring(i + 1).trim();
|
|
1832
1955
|
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1956
|
+
if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
|
|
1957
|
+
return;
|
|
1958
|
+
}
|
|
1836
1959
|
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1960
|
+
if (key === 'set-cookie') {
|
|
1961
|
+
if (parsed[key]) {
|
|
1962
|
+
parsed[key].push(val);
|
|
1963
|
+
} else {
|
|
1964
|
+
parsed[key] = [val];
|
|
1965
|
+
}
|
|
1840
1966
|
} else {
|
|
1841
|
-
parsed[key] = [val
|
|
1967
|
+
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
1842
1968
|
}
|
|
1843
|
-
}
|
|
1844
|
-
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
1845
|
-
}
|
|
1846
|
-
});
|
|
1969
|
+
});
|
|
1847
1970
|
|
|
1848
1971
|
return parsed;
|
|
1849
1972
|
};
|
|
1850
1973
|
|
|
1851
1974
|
const $internals = Symbol('internals');
|
|
1852
1975
|
|
|
1976
|
+
const isValidHeaderValue = (value) => !/[\r\n]/.test(value);
|
|
1977
|
+
|
|
1978
|
+
function assertValidHeaderValue(value, header) {
|
|
1979
|
+
if (value === false || value == null) {
|
|
1980
|
+
return;
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1983
|
+
if (utils$1.isArray(value)) {
|
|
1984
|
+
value.forEach((v) => assertValidHeaderValue(v, header));
|
|
1985
|
+
return;
|
|
1986
|
+
}
|
|
1987
|
+
|
|
1988
|
+
if (!isValidHeaderValue(String(value))) {
|
|
1989
|
+
throw new Error(`Invalid character in header content ["${header}"]`);
|
|
1990
|
+
}
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1853
1993
|
function normalizeHeader(header) {
|
|
1854
1994
|
return header && String(header).trim().toLowerCase();
|
|
1855
1995
|
}
|
|
1856
1996
|
|
|
1997
|
+
function stripTrailingCRLF(str) {
|
|
1998
|
+
let end = str.length;
|
|
1999
|
+
|
|
2000
|
+
while (end > 0) {
|
|
2001
|
+
const charCode = str.charCodeAt(end - 1);
|
|
2002
|
+
|
|
2003
|
+
if (charCode !== 10 && charCode !== 13) {
|
|
2004
|
+
break;
|
|
2005
|
+
}
|
|
2006
|
+
|
|
2007
|
+
end -= 1;
|
|
2008
|
+
}
|
|
2009
|
+
|
|
2010
|
+
return end === str.length ? str : str.slice(0, end);
|
|
2011
|
+
}
|
|
2012
|
+
|
|
1857
2013
|
function normalizeValue(value) {
|
|
1858
2014
|
if (value === false || value == null) {
|
|
1859
2015
|
return value;
|
|
1860
2016
|
}
|
|
1861
2017
|
|
|
1862
|
-
return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
2018
|
+
return utils$1.isArray(value) ? value.map(normalizeValue) : stripTrailingCRLF(String(value));
|
|
1863
2019
|
}
|
|
1864
2020
|
|
|
1865
2021
|
function parseTokens(str) {
|
|
@@ -1897,8 +2053,10 @@ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
|
1897
2053
|
}
|
|
1898
2054
|
|
|
1899
2055
|
function formatHeader(header) {
|
|
1900
|
-
return header
|
|
1901
|
-
.
|
|
2056
|
+
return header
|
|
2057
|
+
.trim()
|
|
2058
|
+
.toLowerCase()
|
|
2059
|
+
.replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
|
1902
2060
|
return char.toUpperCase() + str;
|
|
1903
2061
|
});
|
|
1904
2062
|
}
|
|
@@ -1906,12 +2064,12 @@ function formatHeader(header) {
|
|
|
1906
2064
|
function buildAccessors(obj, header) {
|
|
1907
2065
|
const accessorName = utils$1.toCamelCase(' ' + header);
|
|
1908
2066
|
|
|
1909
|
-
['get', 'set', 'has'].forEach(methodName => {
|
|
2067
|
+
['get', 'set', 'has'].forEach((methodName) => {
|
|
1910
2068
|
Object.defineProperty(obj, methodName + accessorName, {
|
|
1911
|
-
value: function(arg1, arg2, arg3) {
|
|
2069
|
+
value: function (arg1, arg2, arg3) {
|
|
1912
2070
|
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
1913
2071
|
},
|
|
1914
|
-
configurable: true
|
|
2072
|
+
configurable: true,
|
|
1915
2073
|
});
|
|
1916
2074
|
});
|
|
1917
2075
|
}
|
|
@@ -1933,7 +2091,13 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
1933
2091
|
|
|
1934
2092
|
const key = utils$1.findKey(self, lHeader);
|
|
1935
2093
|
|
|
1936
|
-
if
|
|
2094
|
+
if (
|
|
2095
|
+
!key ||
|
|
2096
|
+
self[key] === undefined ||
|
|
2097
|
+
_rewrite === true ||
|
|
2098
|
+
(_rewrite === undefined && self[key] !== false)
|
|
2099
|
+
) {
|
|
2100
|
+
assertValidHeaderValue(_value, _header);
|
|
1937
2101
|
self[key || _header] = normalizeValue(_value);
|
|
1938
2102
|
}
|
|
1939
2103
|
}
|
|
@@ -1943,17 +2107,22 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
1943
2107
|
|
|
1944
2108
|
if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
|
|
1945
2109
|
setHeaders(header, valueOrRewrite);
|
|
1946
|
-
} else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
2110
|
+
} else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
1947
2111
|
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
1948
2112
|
} else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
|
|
1949
|
-
let obj = {},
|
|
2113
|
+
let obj = {},
|
|
2114
|
+
dest,
|
|
2115
|
+
key;
|
|
1950
2116
|
for (const entry of header) {
|
|
1951
2117
|
if (!utils$1.isArray(entry)) {
|
|
1952
2118
|
throw TypeError('Object iterator must return a key-value pair');
|
|
1953
2119
|
}
|
|
1954
2120
|
|
|
1955
|
-
obj[key = entry[0]] = (dest = obj[key])
|
|
1956
|
-
|
|
2121
|
+
obj[(key = entry[0])] = (dest = obj[key])
|
|
2122
|
+
? utils$1.isArray(dest)
|
|
2123
|
+
? [...dest, entry[1]]
|
|
2124
|
+
: [dest, entry[1]]
|
|
2125
|
+
: entry[1];
|
|
1957
2126
|
}
|
|
1958
2127
|
|
|
1959
2128
|
setHeaders(obj, valueOrRewrite);
|
|
@@ -2000,7 +2169,11 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
2000
2169
|
if (header) {
|
|
2001
2170
|
const key = utils$1.findKey(this, header);
|
|
2002
2171
|
|
|
2003
|
-
return !!(
|
|
2172
|
+
return !!(
|
|
2173
|
+
key &&
|
|
2174
|
+
this[key] !== undefined &&
|
|
2175
|
+
(!matcher || matchHeaderValue(this, this[key], key, matcher))
|
|
2176
|
+
);
|
|
2004
2177
|
}
|
|
2005
2178
|
|
|
2006
2179
|
return false;
|
|
@@ -2040,7 +2213,7 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
2040
2213
|
|
|
2041
2214
|
while (i--) {
|
|
2042
2215
|
const key = keys[i];
|
|
2043
|
-
if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
2216
|
+
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
2044
2217
|
delete this[key];
|
|
2045
2218
|
deleted = true;
|
|
2046
2219
|
}
|
|
@@ -2084,7 +2257,9 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
2084
2257
|
const obj = Object.create(null);
|
|
2085
2258
|
|
|
2086
2259
|
utils$1.forEach(this, (value, header) => {
|
|
2087
|
-
value != null &&
|
|
2260
|
+
value != null &&
|
|
2261
|
+
value !== false &&
|
|
2262
|
+
(obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
|
|
2088
2263
|
});
|
|
2089
2264
|
|
|
2090
2265
|
return obj;
|
|
@@ -2095,11 +2270,13 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
2095
2270
|
}
|
|
2096
2271
|
|
|
2097
2272
|
toString() {
|
|
2098
|
-
return Object.entries(this.toJSON())
|
|
2273
|
+
return Object.entries(this.toJSON())
|
|
2274
|
+
.map(([header, value]) => header + ': ' + value)
|
|
2275
|
+
.join('\n');
|
|
2099
2276
|
}
|
|
2100
2277
|
|
|
2101
2278
|
getSetCookie() {
|
|
2102
|
-
return this.get(
|
|
2279
|
+
return this.get('set-cookie') || [];
|
|
2103
2280
|
}
|
|
2104
2281
|
|
|
2105
2282
|
get [Symbol.toStringTag]() {
|
|
@@ -2119,9 +2296,12 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
2119
2296
|
}
|
|
2120
2297
|
|
|
2121
2298
|
static accessor(header) {
|
|
2122
|
-
const internals =
|
|
2123
|
-
|
|
2124
|
-
|
|
2299
|
+
const internals =
|
|
2300
|
+
(this[$internals] =
|
|
2301
|
+
this[$internals] =
|
|
2302
|
+
{
|
|
2303
|
+
accessors: {},
|
|
2304
|
+
});
|
|
2125
2305
|
|
|
2126
2306
|
const accessors = internals.accessors;
|
|
2127
2307
|
const prototype = this.prototype;
|
|
@@ -2141,17 +2321,24 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
2141
2321
|
}
|
|
2142
2322
|
};
|
|
2143
2323
|
|
|
2144
|
-
AxiosHeaders$1.accessor([
|
|
2324
|
+
AxiosHeaders$1.accessor([
|
|
2325
|
+
'Content-Type',
|
|
2326
|
+
'Content-Length',
|
|
2327
|
+
'Accept',
|
|
2328
|
+
'Accept-Encoding',
|
|
2329
|
+
'User-Agent',
|
|
2330
|
+
'Authorization',
|
|
2331
|
+
]);
|
|
2145
2332
|
|
|
2146
2333
|
// reserved names hotfix
|
|
2147
|
-
utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({value}, key) => {
|
|
2334
|
+
utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value }, key) => {
|
|
2148
2335
|
let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
|
|
2149
2336
|
return {
|
|
2150
2337
|
get: () => value,
|
|
2151
2338
|
set(headerValue) {
|
|
2152
2339
|
this[mapped] = headerValue;
|
|
2153
|
-
}
|
|
2154
|
-
}
|
|
2340
|
+
},
|
|
2341
|
+
};
|
|
2155
2342
|
});
|
|
2156
2343
|
|
|
2157
2344
|
utils$1.freezeMethods(AxiosHeaders$1);
|
|
@@ -2214,19 +2401,23 @@ function settle(resolve, reject, response) {
|
|
|
2214
2401
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
2215
2402
|
resolve(response);
|
|
2216
2403
|
} else {
|
|
2217
|
-
reject(
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2404
|
+
reject(
|
|
2405
|
+
new AxiosError$1(
|
|
2406
|
+
'Request failed with status code ' + response.status,
|
|
2407
|
+
[AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][
|
|
2408
|
+
Math.floor(response.status / 100) - 4
|
|
2409
|
+
],
|
|
2410
|
+
response.config,
|
|
2411
|
+
response.request,
|
|
2412
|
+
response
|
|
2413
|
+
)
|
|
2414
|
+
);
|
|
2224
2415
|
}
|
|
2225
2416
|
}
|
|
2226
2417
|
|
|
2227
2418
|
function parseProtocol(url) {
|
|
2228
2419
|
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
2229
|
-
return match && match[1] || '';
|
|
2420
|
+
return (match && match[1]) || '';
|
|
2230
2421
|
}
|
|
2231
2422
|
|
|
2232
2423
|
/**
|
|
@@ -2277,7 +2468,7 @@ function speedometer(samplesCount, min) {
|
|
|
2277
2468
|
|
|
2278
2469
|
const passed = startedAt && now - startedAt;
|
|
2279
2470
|
|
|
2280
|
-
return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
|
|
2471
|
+
return passed ? Math.round((bytesCount * 1000) / passed) : undefined;
|
|
2281
2472
|
};
|
|
2282
2473
|
}
|
|
2283
2474
|
|
|
@@ -2306,7 +2497,7 @@ function throttle(fn, freq) {
|
|
|
2306
2497
|
const throttled = (...args) => {
|
|
2307
2498
|
const now = Date.now();
|
|
2308
2499
|
const passed = now - timestamp;
|
|
2309
|
-
if (
|
|
2500
|
+
if (passed >= threshold) {
|
|
2310
2501
|
invoke(args, now);
|
|
2311
2502
|
} else {
|
|
2312
2503
|
lastArgs = args;
|
|
@@ -2328,7 +2519,7 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
|
2328
2519
|
let bytesNotified = 0;
|
|
2329
2520
|
const _speedometer = speedometer(50, 250);
|
|
2330
2521
|
|
|
2331
|
-
return throttle(e => {
|
|
2522
|
+
return throttle((e) => {
|
|
2332
2523
|
const loaded = e.loaded;
|
|
2333
2524
|
const total = e.lengthComputable ? e.total : undefined;
|
|
2334
2525
|
const progressBytes = loaded - bytesNotified;
|
|
@@ -2340,13 +2531,13 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
|
2340
2531
|
const data = {
|
|
2341
2532
|
loaded,
|
|
2342
2533
|
total,
|
|
2343
|
-
progress: total ?
|
|
2534
|
+
progress: total ? loaded / total : undefined,
|
|
2344
2535
|
bytes: progressBytes,
|
|
2345
2536
|
rate: rate ? rate : undefined,
|
|
2346
2537
|
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
|
2347
2538
|
event: e,
|
|
2348
2539
|
lengthComputable: total != null,
|
|
2349
|
-
[isDownloadStream ? 'download' : 'upload']: true
|
|
2540
|
+
[isDownloadStream ? 'download' : 'upload']: true,
|
|
2350
2541
|
};
|
|
2351
2542
|
|
|
2352
2543
|
listener(data);
|
|
@@ -2356,77 +2547,82 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
|
2356
2547
|
const progressEventDecorator = (total, throttled) => {
|
|
2357
2548
|
const lengthComputable = total != null;
|
|
2358
2549
|
|
|
2359
|
-
return [
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2550
|
+
return [
|
|
2551
|
+
(loaded) =>
|
|
2552
|
+
throttled[0]({
|
|
2553
|
+
lengthComputable,
|
|
2554
|
+
total,
|
|
2555
|
+
loaded,
|
|
2556
|
+
}),
|
|
2557
|
+
throttled[1],
|
|
2558
|
+
];
|
|
2364
2559
|
};
|
|
2365
2560
|
|
|
2366
|
-
const asyncDecorator =
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
return (
|
|
2372
|
-
origin.protocol === url.protocol &&
|
|
2373
|
-
origin.host === url.host &&
|
|
2374
|
-
(isMSIE || origin.port === url.port)
|
|
2375
|
-
);
|
|
2376
|
-
})(
|
|
2377
|
-
new URL(platform.origin),
|
|
2378
|
-
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
|
2379
|
-
) : () => true;
|
|
2380
|
-
|
|
2381
|
-
var cookies = platform.hasStandardBrowserEnv ?
|
|
2561
|
+
const asyncDecorator =
|
|
2562
|
+
(fn) =>
|
|
2563
|
+
(...args) =>
|
|
2564
|
+
utils$1.asap(() => fn(...args));
|
|
2382
2565
|
|
|
2383
|
-
|
|
2384
|
-
{
|
|
2385
|
-
|
|
2386
|
-
if (typeof document === 'undefined') return;
|
|
2566
|
+
var isURLSameOrigin = platform.hasStandardBrowserEnv
|
|
2567
|
+
? ((origin, isMSIE) => (url) => {
|
|
2568
|
+
url = new URL(url, platform.origin);
|
|
2387
2569
|
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2570
|
+
return (
|
|
2571
|
+
origin.protocol === url.protocol &&
|
|
2572
|
+
origin.host === url.host &&
|
|
2573
|
+
(isMSIE || origin.port === url.port)
|
|
2574
|
+
);
|
|
2575
|
+
})(
|
|
2576
|
+
new URL(platform.origin),
|
|
2577
|
+
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
|
2578
|
+
)
|
|
2579
|
+
: () => true;
|
|
2580
|
+
|
|
2581
|
+
var cookies = platform.hasStandardBrowserEnv
|
|
2582
|
+
? // Standard browser envs support document.cookie
|
|
2583
|
+
{
|
|
2584
|
+
write(name, value, expires, path, domain, secure, sameSite) {
|
|
2585
|
+
if (typeof document === 'undefined') return;
|
|
2586
|
+
|
|
2587
|
+
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
2588
|
+
|
|
2589
|
+
if (utils$1.isNumber(expires)) {
|
|
2590
|
+
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
2591
|
+
}
|
|
2592
|
+
if (utils$1.isString(path)) {
|
|
2593
|
+
cookie.push(`path=${path}`);
|
|
2594
|
+
}
|
|
2595
|
+
if (utils$1.isString(domain)) {
|
|
2596
|
+
cookie.push(`domain=${domain}`);
|
|
2597
|
+
}
|
|
2598
|
+
if (secure === true) {
|
|
2599
|
+
cookie.push('secure');
|
|
2600
|
+
}
|
|
2601
|
+
if (utils$1.isString(sameSite)) {
|
|
2602
|
+
cookie.push(`SameSite=${sameSite}`);
|
|
2603
|
+
}
|
|
2405
2604
|
|
|
2406
|
-
|
|
2407
|
-
|
|
2605
|
+
document.cookie = cookie.join('; ');
|
|
2606
|
+
},
|
|
2408
2607
|
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2608
|
+
read(name) {
|
|
2609
|
+
if (typeof document === 'undefined') return null;
|
|
2610
|
+
const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
|
|
2611
|
+
return match ? decodeURIComponent(match[1]) : null;
|
|
2612
|
+
},
|
|
2414
2613
|
|
|
2415
|
-
|
|
2416
|
-
|
|
2614
|
+
remove(name) {
|
|
2615
|
+
this.write(name, '', Date.now() - 86400000, '/');
|
|
2616
|
+
},
|
|
2417
2617
|
}
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
return null;
|
|
2427
|
-
},
|
|
2428
|
-
remove() {}
|
|
2429
|
-
};
|
|
2618
|
+
: // Non-standard browser env (web workers, react-native) lack needed support.
|
|
2619
|
+
{
|
|
2620
|
+
write() {},
|
|
2621
|
+
read() {
|
|
2622
|
+
return null;
|
|
2623
|
+
},
|
|
2624
|
+
remove() {},
|
|
2625
|
+
};
|
|
2430
2626
|
|
|
2431
2627
|
/**
|
|
2432
2628
|
* Determines whether the specified URL is absolute
|
|
@@ -2478,8 +2674,7 @@ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
|
2478
2674
|
return requestedURL;
|
|
2479
2675
|
}
|
|
2480
2676
|
|
|
2481
|
-
const headersToObject = (thing) =>
|
|
2482
|
-
thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
|
|
2677
|
+
const headersToObject = (thing) => (thing instanceof AxiosHeaders$1 ? { ...thing } : thing);
|
|
2483
2678
|
|
|
2484
2679
|
/**
|
|
2485
2680
|
* Config-specific merge-function which creates a new config-object
|
|
@@ -2572,23 +2767,12 @@ function mergeConfig$1(config1, config2) {
|
|
|
2572
2767
|
mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true),
|
|
2573
2768
|
};
|
|
2574
2769
|
|
|
2575
|
-
utils$1.forEach(
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
prop === "prototype"
|
|
2582
|
-
)
|
|
2583
|
-
return;
|
|
2584
|
-
const merge = utils$1.hasOwnProp(mergeMap, prop)
|
|
2585
|
-
? mergeMap[prop]
|
|
2586
|
-
: mergeDeepProperties;
|
|
2587
|
-
const configValue = merge(config1[prop], config2[prop], prop);
|
|
2588
|
-
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) ||
|
|
2589
|
-
(config[prop] = configValue);
|
|
2590
|
-
},
|
|
2591
|
-
);
|
|
2770
|
+
utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
|
|
2771
|
+
if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
|
|
2772
|
+
const merge = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
|
|
2773
|
+
const configValue = merge(config1[prop], config2[prop], prop);
|
|
2774
|
+
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
2775
|
+
});
|
|
2592
2776
|
|
|
2593
2777
|
return config;
|
|
2594
2778
|
}
|
|
@@ -2600,12 +2784,22 @@ var resolveConfig = (config) => {
|
|
|
2600
2784
|
|
|
2601
2785
|
newConfig.headers = headers = AxiosHeaders$1.from(headers);
|
|
2602
2786
|
|
|
2603
|
-
newConfig.url = buildURL(
|
|
2787
|
+
newConfig.url = buildURL(
|
|
2788
|
+
buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls),
|
|
2789
|
+
config.params,
|
|
2790
|
+
config.paramsSerializer
|
|
2791
|
+
);
|
|
2604
2792
|
|
|
2605
2793
|
// HTTP basic authentication
|
|
2606
2794
|
if (auth) {
|
|
2607
|
-
headers.set(
|
|
2608
|
-
|
|
2795
|
+
headers.set(
|
|
2796
|
+
'Authorization',
|
|
2797
|
+
'Basic ' +
|
|
2798
|
+
btoa(
|
|
2799
|
+
(auth.username || '') +
|
|
2800
|
+
':' +
|
|
2801
|
+
(auth.password ? unescape(encodeURIComponent(auth.password)) : '')
|
|
2802
|
+
)
|
|
2609
2803
|
);
|
|
2610
2804
|
}
|
|
2611
2805
|
|
|
@@ -2623,7 +2817,7 @@ var resolveConfig = (config) => {
|
|
|
2623
2817
|
}
|
|
2624
2818
|
});
|
|
2625
2819
|
}
|
|
2626
|
-
}
|
|
2820
|
+
}
|
|
2627
2821
|
|
|
2628
2822
|
// Add xsrf header
|
|
2629
2823
|
// This is only done if running in a standard browser environment.
|
|
@@ -2647,196 +2841,218 @@ var resolveConfig = (config) => {
|
|
|
2647
2841
|
|
|
2648
2842
|
const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
|
2649
2843
|
|
|
2650
|
-
var xhrAdapter = isXHRAdapterSupported &&
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2844
|
+
var xhrAdapter = isXHRAdapterSupported &&
|
|
2845
|
+
function (config) {
|
|
2846
|
+
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
2847
|
+
const _config = resolveConfig(config);
|
|
2848
|
+
let requestData = _config.data;
|
|
2849
|
+
const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
|
|
2850
|
+
let { responseType, onUploadProgress, onDownloadProgress } = _config;
|
|
2851
|
+
let onCanceled;
|
|
2852
|
+
let uploadThrottled, downloadThrottled;
|
|
2853
|
+
let flushUpload, flushDownload;
|
|
2659
2854
|
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2855
|
+
function done() {
|
|
2856
|
+
flushUpload && flushUpload(); // flush events
|
|
2857
|
+
flushDownload && flushDownload(); // flush events
|
|
2663
2858
|
|
|
2664
|
-
|
|
2859
|
+
_config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
|
|
2665
2860
|
|
|
2666
|
-
|
|
2667
|
-
|
|
2861
|
+
_config.signal && _config.signal.removeEventListener('abort', onCanceled);
|
|
2862
|
+
}
|
|
2668
2863
|
|
|
2669
|
-
|
|
2864
|
+
let request = new XMLHttpRequest();
|
|
2670
2865
|
|
|
2671
|
-
|
|
2866
|
+
request.open(_config.method.toUpperCase(), _config.url, true);
|
|
2672
2867
|
|
|
2673
|
-
|
|
2674
|
-
|
|
2868
|
+
// Set the request timeout in MS
|
|
2869
|
+
request.timeout = _config.timeout;
|
|
2675
2870
|
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2871
|
+
function onloadend() {
|
|
2872
|
+
if (!request) {
|
|
2873
|
+
return;
|
|
2874
|
+
}
|
|
2875
|
+
// Prepare the response
|
|
2876
|
+
const responseHeaders = AxiosHeaders$1.from(
|
|
2877
|
+
'getAllResponseHeaders' in request && request.getAllResponseHeaders()
|
|
2878
|
+
);
|
|
2879
|
+
const responseData =
|
|
2880
|
+
!responseType || responseType === 'text' || responseType === 'json'
|
|
2881
|
+
? request.responseText
|
|
2882
|
+
: request.response;
|
|
2883
|
+
const response = {
|
|
2884
|
+
data: responseData,
|
|
2885
|
+
status: request.status,
|
|
2886
|
+
statusText: request.statusText,
|
|
2887
|
+
headers: responseHeaders,
|
|
2888
|
+
config,
|
|
2889
|
+
request,
|
|
2890
|
+
};
|
|
2891
|
+
|
|
2892
|
+
settle(
|
|
2893
|
+
function _resolve(value) {
|
|
2894
|
+
resolve(value);
|
|
2895
|
+
done();
|
|
2896
|
+
},
|
|
2897
|
+
function _reject(err) {
|
|
2898
|
+
reject(err);
|
|
2899
|
+
done();
|
|
2900
|
+
},
|
|
2901
|
+
response
|
|
2902
|
+
);
|
|
2903
|
+
|
|
2904
|
+
// Clean up request
|
|
2905
|
+
request = null;
|
|
2679
2906
|
}
|
|
2680
|
-
// Prepare the response
|
|
2681
|
-
const responseHeaders = AxiosHeaders$1.from(
|
|
2682
|
-
'getAllResponseHeaders' in request && request.getAllResponseHeaders()
|
|
2683
|
-
);
|
|
2684
|
-
const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
|
|
2685
|
-
request.responseText : request.response;
|
|
2686
|
-
const response = {
|
|
2687
|
-
data: responseData,
|
|
2688
|
-
status: request.status,
|
|
2689
|
-
statusText: request.statusText,
|
|
2690
|
-
headers: responseHeaders,
|
|
2691
|
-
config,
|
|
2692
|
-
request
|
|
2693
|
-
};
|
|
2694
2907
|
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
}
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2908
|
+
if ('onloadend' in request) {
|
|
2909
|
+
// Use onloadend if available
|
|
2910
|
+
request.onloadend = onloadend;
|
|
2911
|
+
} else {
|
|
2912
|
+
// Listen for ready state to emulate onloadend
|
|
2913
|
+
request.onreadystatechange = function handleLoad() {
|
|
2914
|
+
if (!request || request.readyState !== 4) {
|
|
2915
|
+
return;
|
|
2916
|
+
}
|
|
2702
2917
|
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2918
|
+
// The request errored out and we didn't get a response, this will be
|
|
2919
|
+
// handled by onerror instead
|
|
2920
|
+
// With one exception: request that using file: protocol, most browsers
|
|
2921
|
+
// will return status as 0 even though it's a successful request
|
|
2922
|
+
if (
|
|
2923
|
+
request.status === 0 &&
|
|
2924
|
+
!(request.responseURL && request.responseURL.indexOf('file:') === 0)
|
|
2925
|
+
) {
|
|
2926
|
+
return;
|
|
2927
|
+
}
|
|
2928
|
+
// readystate handler is calling before onerror or ontimeout handlers,
|
|
2929
|
+
// so we should call onloadend on the next 'tick'
|
|
2930
|
+
setTimeout(onloadend);
|
|
2931
|
+
};
|
|
2932
|
+
}
|
|
2706
2933
|
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
} else {
|
|
2711
|
-
// Listen for ready state to emulate onloadend
|
|
2712
|
-
request.onreadystatechange = function handleLoad() {
|
|
2713
|
-
if (!request || request.readyState !== 4) {
|
|
2934
|
+
// Handle browser request cancellation (as opposed to a manual cancellation)
|
|
2935
|
+
request.onabort = function handleAbort() {
|
|
2936
|
+
if (!request) {
|
|
2714
2937
|
return;
|
|
2715
2938
|
}
|
|
2716
2939
|
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
//
|
|
2720
|
-
|
|
2721
|
-
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
|
|
2722
|
-
return;
|
|
2723
|
-
}
|
|
2724
|
-
// readystate handler is calling before onerror or ontimeout handlers,
|
|
2725
|
-
// so we should call onloadend on the next 'tick'
|
|
2726
|
-
setTimeout(onloadend);
|
|
2940
|
+
reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
|
|
2941
|
+
|
|
2942
|
+
// Clean up request
|
|
2943
|
+
request = null;
|
|
2727
2944
|
};
|
|
2728
|
-
}
|
|
2729
2945
|
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2946
|
+
// Handle low level network errors
|
|
2947
|
+
request.onerror = function handleError(event) {
|
|
2948
|
+
// Browsers deliver a ProgressEvent in XHR onerror
|
|
2949
|
+
// (message may be empty; when present, surface it)
|
|
2950
|
+
// See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
|
|
2951
|
+
const msg = event && event.message ? event.message : 'Network Error';
|
|
2952
|
+
const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
|
|
2953
|
+
// attach the underlying event for consumers who want details
|
|
2954
|
+
err.event = event || null;
|
|
2955
|
+
reject(err);
|
|
2956
|
+
request = null;
|
|
2957
|
+
};
|
|
2735
2958
|
|
|
2736
|
-
|
|
2959
|
+
// Handle timeout
|
|
2960
|
+
request.ontimeout = function handleTimeout() {
|
|
2961
|
+
let timeoutErrorMessage = _config.timeout
|
|
2962
|
+
? 'timeout of ' + _config.timeout + 'ms exceeded'
|
|
2963
|
+
: 'timeout exceeded';
|
|
2964
|
+
const transitional = _config.transitional || transitionalDefaults;
|
|
2965
|
+
if (_config.timeoutErrorMessage) {
|
|
2966
|
+
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
2967
|
+
}
|
|
2968
|
+
reject(
|
|
2969
|
+
new AxiosError$1(
|
|
2970
|
+
timeoutErrorMessage,
|
|
2971
|
+
transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
|
|
2972
|
+
config,
|
|
2973
|
+
request
|
|
2974
|
+
)
|
|
2975
|
+
);
|
|
2737
2976
|
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2977
|
+
// Clean up request
|
|
2978
|
+
request = null;
|
|
2979
|
+
};
|
|
2741
2980
|
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
// Browsers deliver a ProgressEvent in XHR onerror
|
|
2745
|
-
// (message may be empty; when present, surface it)
|
|
2746
|
-
// See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
|
|
2747
|
-
const msg = event && event.message ? event.message : 'Network Error';
|
|
2748
|
-
const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
|
|
2749
|
-
// attach the underlying event for consumers who want details
|
|
2750
|
-
err.event = event || null;
|
|
2751
|
-
reject(err);
|
|
2752
|
-
request = null;
|
|
2753
|
-
};
|
|
2754
|
-
|
|
2755
|
-
// Handle timeout
|
|
2756
|
-
request.ontimeout = function handleTimeout() {
|
|
2757
|
-
let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
|
|
2758
|
-
const transitional = _config.transitional || transitionalDefaults;
|
|
2759
|
-
if (_config.timeoutErrorMessage) {
|
|
2760
|
-
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
2761
|
-
}
|
|
2762
|
-
reject(new AxiosError$1(
|
|
2763
|
-
timeoutErrorMessage,
|
|
2764
|
-
transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
|
|
2765
|
-
config,
|
|
2766
|
-
request));
|
|
2767
|
-
|
|
2768
|
-
// Clean up request
|
|
2769
|
-
request = null;
|
|
2770
|
-
};
|
|
2981
|
+
// Remove Content-Type if data is undefined
|
|
2982
|
+
requestData === undefined && requestHeaders.setContentType(null);
|
|
2771
2983
|
|
|
2772
|
-
|
|
2773
|
-
|
|
2984
|
+
// Add headers to the request
|
|
2985
|
+
if ('setRequestHeader' in request) {
|
|
2986
|
+
utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
|
2987
|
+
request.setRequestHeader(key, val);
|
|
2988
|
+
});
|
|
2989
|
+
}
|
|
2774
2990
|
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
});
|
|
2780
|
-
}
|
|
2991
|
+
// Add withCredentials to request if needed
|
|
2992
|
+
if (!utils$1.isUndefined(_config.withCredentials)) {
|
|
2993
|
+
request.withCredentials = !!_config.withCredentials;
|
|
2994
|
+
}
|
|
2781
2995
|
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2996
|
+
// Add responseType to request if needed
|
|
2997
|
+
if (responseType && responseType !== 'json') {
|
|
2998
|
+
request.responseType = _config.responseType;
|
|
2999
|
+
}
|
|
2786
3000
|
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
3001
|
+
// Handle progress if needed
|
|
3002
|
+
if (onDownloadProgress) {
|
|
3003
|
+
[downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
|
|
3004
|
+
request.addEventListener('progress', downloadThrottled);
|
|
3005
|
+
}
|
|
2791
3006
|
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
request.addEventListener('progress', downloadThrottled);
|
|
2796
|
-
}
|
|
3007
|
+
// Not all browsers support upload events
|
|
3008
|
+
if (onUploadProgress && request.upload) {
|
|
3009
|
+
[uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
|
|
2797
3010
|
|
|
2798
|
-
|
|
2799
|
-
if (onUploadProgress && request.upload) {
|
|
2800
|
-
([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress));
|
|
3011
|
+
request.upload.addEventListener('progress', uploadThrottled);
|
|
2801
3012
|
|
|
2802
|
-
|
|
3013
|
+
request.upload.addEventListener('loadend', flushUpload);
|
|
3014
|
+
}
|
|
2803
3015
|
|
|
2804
|
-
|
|
2805
|
-
|
|
3016
|
+
if (_config.cancelToken || _config.signal) {
|
|
3017
|
+
// Handle cancellation
|
|
3018
|
+
// eslint-disable-next-line func-names
|
|
3019
|
+
onCanceled = (cancel) => {
|
|
3020
|
+
if (!request) {
|
|
3021
|
+
return;
|
|
3022
|
+
}
|
|
3023
|
+
reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
|
|
3024
|
+
request.abort();
|
|
3025
|
+
request = null;
|
|
3026
|
+
};
|
|
2806
3027
|
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
return;
|
|
3028
|
+
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
|
3029
|
+
if (_config.signal) {
|
|
3030
|
+
_config.signal.aborted
|
|
3031
|
+
? onCanceled()
|
|
3032
|
+
: _config.signal.addEventListener('abort', onCanceled);
|
|
2813
3033
|
}
|
|
2814
|
-
reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
|
|
2815
|
-
request.abort();
|
|
2816
|
-
request = null;
|
|
2817
|
-
};
|
|
2818
|
-
|
|
2819
|
-
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
|
2820
|
-
if (_config.signal) {
|
|
2821
|
-
_config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
|
|
2822
3034
|
}
|
|
2823
|
-
}
|
|
2824
|
-
|
|
2825
|
-
const protocol = parseProtocol(_config.url);
|
|
2826
3035
|
|
|
2827
|
-
|
|
2828
|
-
reject(new AxiosError$1('Unsupported protocol ' + protocol + ':', AxiosError$1.ERR_BAD_REQUEST, config));
|
|
2829
|
-
return;
|
|
2830
|
-
}
|
|
3036
|
+
const protocol = parseProtocol(_config.url);
|
|
2831
3037
|
|
|
3038
|
+
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
3039
|
+
reject(
|
|
3040
|
+
new AxiosError$1(
|
|
3041
|
+
'Unsupported protocol ' + protocol + ':',
|
|
3042
|
+
AxiosError$1.ERR_BAD_REQUEST,
|
|
3043
|
+
config
|
|
3044
|
+
)
|
|
3045
|
+
);
|
|
3046
|
+
return;
|
|
3047
|
+
}
|
|
2832
3048
|
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
};
|
|
3049
|
+
// Send the request
|
|
3050
|
+
request.send(requestData || null);
|
|
3051
|
+
});
|
|
3052
|
+
};
|
|
2837
3053
|
|
|
2838
3054
|
const composeSignals = (signals, timeout) => {
|
|
2839
|
-
const {length} = (signals = signals ? signals.filter(Boolean) : []);
|
|
3055
|
+
const { length } = (signals = signals ? signals.filter(Boolean) : []);
|
|
2840
3056
|
|
|
2841
3057
|
if (timeout || length) {
|
|
2842
3058
|
let controller = new AbortController();
|
|
@@ -2848,21 +3064,29 @@ const composeSignals = (signals, timeout) => {
|
|
|
2848
3064
|
aborted = true;
|
|
2849
3065
|
unsubscribe();
|
|
2850
3066
|
const err = reason instanceof Error ? reason : this.reason;
|
|
2851
|
-
controller.abort(
|
|
3067
|
+
controller.abort(
|
|
3068
|
+
err instanceof AxiosError$1
|
|
3069
|
+
? err
|
|
3070
|
+
: new CanceledError$1(err instanceof Error ? err.message : err)
|
|
3071
|
+
);
|
|
2852
3072
|
}
|
|
2853
3073
|
};
|
|
2854
3074
|
|
|
2855
|
-
let timer =
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
3075
|
+
let timer =
|
|
3076
|
+
timeout &&
|
|
3077
|
+
setTimeout(() => {
|
|
3078
|
+
timer = null;
|
|
3079
|
+
onabort(new AxiosError$1(`timeout of ${timeout}ms exceeded`, AxiosError$1.ETIMEDOUT));
|
|
3080
|
+
}, timeout);
|
|
2859
3081
|
|
|
2860
3082
|
const unsubscribe = () => {
|
|
2861
3083
|
if (signals) {
|
|
2862
3084
|
timer && clearTimeout(timer);
|
|
2863
3085
|
timer = null;
|
|
2864
|
-
signals.forEach(signal => {
|
|
2865
|
-
signal.unsubscribe
|
|
3086
|
+
signals.forEach((signal) => {
|
|
3087
|
+
signal.unsubscribe
|
|
3088
|
+
? signal.unsubscribe(onabort)
|
|
3089
|
+
: signal.removeEventListener('abort', onabort);
|
|
2866
3090
|
});
|
|
2867
3091
|
signals = null;
|
|
2868
3092
|
}
|
|
@@ -2870,7 +3094,7 @@ const composeSignals = (signals, timeout) => {
|
|
|
2870
3094
|
|
|
2871
3095
|
signals.forEach((signal) => signal.addEventListener('abort', onabort));
|
|
2872
3096
|
|
|
2873
|
-
const {signal} = controller;
|
|
3097
|
+
const { signal } = controller;
|
|
2874
3098
|
|
|
2875
3099
|
signal.unsubscribe = () => utils$1.asap(unsubscribe);
|
|
2876
3100
|
|
|
@@ -2911,7 +3135,7 @@ const readStream = async function* (stream) {
|
|
|
2911
3135
|
const reader = stream.getReader();
|
|
2912
3136
|
try {
|
|
2913
3137
|
for (;;) {
|
|
2914
|
-
const {done, value} = await reader.read();
|
|
3138
|
+
const { done, value } = await reader.read();
|
|
2915
3139
|
if (done) {
|
|
2916
3140
|
break;
|
|
2917
3141
|
}
|
|
@@ -2934,64 +3158,69 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
|
2934
3158
|
}
|
|
2935
3159
|
};
|
|
2936
3160
|
|
|
2937
|
-
return new ReadableStream(
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
3161
|
+
return new ReadableStream(
|
|
3162
|
+
{
|
|
3163
|
+
async pull(controller) {
|
|
3164
|
+
try {
|
|
3165
|
+
const { done, value } = await iterator.next();
|
|
2941
3166
|
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
3167
|
+
if (done) {
|
|
3168
|
+
_onFinish();
|
|
3169
|
+
controller.close();
|
|
3170
|
+
return;
|
|
3171
|
+
}
|
|
2947
3172
|
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
3173
|
+
let len = value.byteLength;
|
|
3174
|
+
if (onProgress) {
|
|
3175
|
+
let loadedBytes = (bytes += len);
|
|
3176
|
+
onProgress(loadedBytes);
|
|
3177
|
+
}
|
|
3178
|
+
controller.enqueue(new Uint8Array(value));
|
|
3179
|
+
} catch (err) {
|
|
3180
|
+
_onFinish(err);
|
|
3181
|
+
throw err;
|
|
2952
3182
|
}
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
_onFinish(
|
|
2956
|
-
|
|
2957
|
-
}
|
|
3183
|
+
},
|
|
3184
|
+
cancel(reason) {
|
|
3185
|
+
_onFinish(reason);
|
|
3186
|
+
return iterator.return();
|
|
3187
|
+
},
|
|
2958
3188
|
},
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
return iterator.return();
|
|
3189
|
+
{
|
|
3190
|
+
highWaterMark: 2,
|
|
2962
3191
|
}
|
|
2963
|
-
|
|
2964
|
-
highWaterMark: 2
|
|
2965
|
-
})
|
|
3192
|
+
);
|
|
2966
3193
|
};
|
|
2967
3194
|
|
|
2968
3195
|
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
2969
3196
|
|
|
2970
|
-
const {isFunction} = utils$1;
|
|
3197
|
+
const { isFunction } = utils$1;
|
|
2971
3198
|
|
|
2972
|
-
const globalFetchAPI = (({Request, Response}) => ({
|
|
2973
|
-
Request,
|
|
3199
|
+
const globalFetchAPI = (({ Request, Response }) => ({
|
|
3200
|
+
Request,
|
|
3201
|
+
Response,
|
|
2974
3202
|
}))(utils$1.global);
|
|
2975
3203
|
|
|
2976
|
-
const {
|
|
2977
|
-
ReadableStream: ReadableStream$1, TextEncoder
|
|
2978
|
-
} = utils$1.global;
|
|
2979
|
-
|
|
3204
|
+
const { ReadableStream: ReadableStream$1, TextEncoder } = utils$1.global;
|
|
2980
3205
|
|
|
2981
3206
|
const test = (fn, ...args) => {
|
|
2982
3207
|
try {
|
|
2983
3208
|
return !!fn(...args);
|
|
2984
3209
|
} catch (e) {
|
|
2985
|
-
return false
|
|
3210
|
+
return false;
|
|
2986
3211
|
}
|
|
2987
3212
|
};
|
|
2988
3213
|
|
|
2989
3214
|
const factory = (env) => {
|
|
2990
|
-
env = utils$1.merge.call(
|
|
2991
|
-
|
|
2992
|
-
|
|
3215
|
+
env = utils$1.merge.call(
|
|
3216
|
+
{
|
|
3217
|
+
skipUndefined: true,
|
|
3218
|
+
},
|
|
3219
|
+
globalFetchAPI,
|
|
3220
|
+
env
|
|
3221
|
+
);
|
|
2993
3222
|
|
|
2994
|
-
const {fetch: envFetch, Request, Response} = env;
|
|
3223
|
+
const { fetch: envFetch, Request, Response } = env;
|
|
2995
3224
|
const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
|
|
2996
3225
|
const isRequestSupported = isFunction(Request);
|
|
2997
3226
|
const isResponseSupported = isFunction(Response);
|
|
@@ -3002,46 +3231,65 @@ const factory = (env) => {
|
|
|
3002
3231
|
|
|
3003
3232
|
const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
|
|
3004
3233
|
|
|
3005
|
-
const encodeText =
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3234
|
+
const encodeText =
|
|
3235
|
+
isFetchSupported &&
|
|
3236
|
+
(typeof TextEncoder === 'function'
|
|
3237
|
+
? (
|
|
3238
|
+
(encoder) => (str) =>
|
|
3239
|
+
encoder.encode(str)
|
|
3240
|
+
)(new TextEncoder())
|
|
3241
|
+
: async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
|
|
3009
3242
|
|
|
3010
|
-
const supportsRequestStream =
|
|
3011
|
-
|
|
3243
|
+
const supportsRequestStream =
|
|
3244
|
+
isRequestSupported &&
|
|
3245
|
+
isReadableStreamSupported &&
|
|
3246
|
+
test(() => {
|
|
3247
|
+
let duplexAccessed = false;
|
|
3012
3248
|
|
|
3013
|
-
|
|
3014
|
-
body: new ReadableStream$1(),
|
|
3015
|
-
method: 'POST',
|
|
3016
|
-
get duplex() {
|
|
3017
|
-
duplexAccessed = true;
|
|
3018
|
-
return 'half';
|
|
3019
|
-
},
|
|
3020
|
-
}).headers.has('Content-Type');
|
|
3249
|
+
const body = new ReadableStream$1();
|
|
3021
3250
|
|
|
3022
|
-
|
|
3023
|
-
|
|
3251
|
+
const hasContentType = new Request(platform.origin, {
|
|
3252
|
+
body,
|
|
3253
|
+
method: 'POST',
|
|
3254
|
+
get duplex() {
|
|
3255
|
+
duplexAccessed = true;
|
|
3256
|
+
return 'half';
|
|
3257
|
+
},
|
|
3258
|
+
}).headers.has('Content-Type');
|
|
3259
|
+
|
|
3260
|
+
body.cancel();
|
|
3261
|
+
|
|
3262
|
+
return duplexAccessed && !hasContentType;
|
|
3263
|
+
});
|
|
3024
3264
|
|
|
3025
|
-
const supportsResponseStream =
|
|
3265
|
+
const supportsResponseStream =
|
|
3266
|
+
isResponseSupported &&
|
|
3267
|
+
isReadableStreamSupported &&
|
|
3026
3268
|
test(() => utils$1.isReadableStream(new Response('').body));
|
|
3027
3269
|
|
|
3028
3270
|
const resolvers = {
|
|
3029
|
-
stream: supportsResponseStream && ((res) => res.body)
|
|
3271
|
+
stream: supportsResponseStream && ((res) => res.body),
|
|
3030
3272
|
};
|
|
3031
3273
|
|
|
3032
|
-
isFetchSupported &&
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3274
|
+
isFetchSupported &&
|
|
3275
|
+
(() => {
|
|
3276
|
+
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach((type) => {
|
|
3277
|
+
!resolvers[type] &&
|
|
3278
|
+
(resolvers[type] = (res, config) => {
|
|
3279
|
+
let method = res && res[type];
|
|
3036
3280
|
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3281
|
+
if (method) {
|
|
3282
|
+
return method.call(res);
|
|
3283
|
+
}
|
|
3040
3284
|
|
|
3041
|
-
|
|
3285
|
+
throw new AxiosError$1(
|
|
3286
|
+
`Response type '${type}' is not supported`,
|
|
3287
|
+
AxiosError$1.ERR_NOT_SUPPORT,
|
|
3288
|
+
config
|
|
3289
|
+
);
|
|
3290
|
+
});
|
|
3042
3291
|
});
|
|
3043
|
-
});
|
|
3044
|
-
})());
|
|
3292
|
+
})();
|
|
3045
3293
|
|
|
3046
3294
|
const getBodyLength = async (body) => {
|
|
3047
3295
|
if (body == null) {
|
|
@@ -3092,32 +3340,41 @@ const factory = (env) => {
|
|
|
3092
3340
|
responseType,
|
|
3093
3341
|
headers,
|
|
3094
3342
|
withCredentials = 'same-origin',
|
|
3095
|
-
fetchOptions
|
|
3343
|
+
fetchOptions,
|
|
3096
3344
|
} = resolveConfig(config);
|
|
3097
3345
|
|
|
3098
3346
|
let _fetch = envFetch || fetch;
|
|
3099
3347
|
|
|
3100
3348
|
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
3101
3349
|
|
|
3102
|
-
let composedSignal = composeSignals(
|
|
3350
|
+
let composedSignal = composeSignals(
|
|
3351
|
+
[signal, cancelToken && cancelToken.toAbortSignal()],
|
|
3352
|
+
timeout
|
|
3353
|
+
);
|
|
3103
3354
|
|
|
3104
3355
|
let request = null;
|
|
3105
3356
|
|
|
3106
|
-
const unsubscribe =
|
|
3107
|
-
composedSignal
|
|
3108
|
-
|
|
3357
|
+
const unsubscribe =
|
|
3358
|
+
composedSignal &&
|
|
3359
|
+
composedSignal.unsubscribe &&
|
|
3360
|
+
(() => {
|
|
3361
|
+
composedSignal.unsubscribe();
|
|
3362
|
+
});
|
|
3109
3363
|
|
|
3110
3364
|
let requestContentLength;
|
|
3111
3365
|
|
|
3112
3366
|
try {
|
|
3113
3367
|
if (
|
|
3114
|
-
onUploadProgress &&
|
|
3368
|
+
onUploadProgress &&
|
|
3369
|
+
supportsRequestStream &&
|
|
3370
|
+
method !== 'get' &&
|
|
3371
|
+
method !== 'head' &&
|
|
3115
3372
|
(requestContentLength = await resolveBodyLength(headers, data)) !== 0
|
|
3116
3373
|
) {
|
|
3117
3374
|
let _request = new Request(url, {
|
|
3118
3375
|
method: 'POST',
|
|
3119
3376
|
body: data,
|
|
3120
|
-
duplex:
|
|
3377
|
+
duplex: 'half',
|
|
3121
3378
|
});
|
|
3122
3379
|
|
|
3123
3380
|
let contentTypeHeader;
|
|
@@ -3142,7 +3399,7 @@ const factory = (env) => {
|
|
|
3142
3399
|
|
|
3143
3400
|
// Cloudflare Workers throws when credentials are defined
|
|
3144
3401
|
// see https://github.com/cloudflare/workerd/issues/902
|
|
3145
|
-
const isCredentialsSupported = isRequestSupported &&
|
|
3402
|
+
const isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype;
|
|
3146
3403
|
|
|
3147
3404
|
const resolvedOptions = {
|
|
3148
3405
|
...fetchOptions,
|
|
@@ -3150,29 +3407,35 @@ const factory = (env) => {
|
|
|
3150
3407
|
method: method.toUpperCase(),
|
|
3151
3408
|
headers: headers.normalize().toJSON(),
|
|
3152
3409
|
body: data,
|
|
3153
|
-
duplex:
|
|
3154
|
-
credentials: isCredentialsSupported ? withCredentials : undefined
|
|
3410
|
+
duplex: 'half',
|
|
3411
|
+
credentials: isCredentialsSupported ? withCredentials : undefined,
|
|
3155
3412
|
};
|
|
3156
3413
|
|
|
3157
3414
|
request = isRequestSupported && new Request(url, resolvedOptions);
|
|
3158
3415
|
|
|
3159
|
-
let response = await (isRequestSupported
|
|
3416
|
+
let response = await (isRequestSupported
|
|
3417
|
+
? _fetch(request, fetchOptions)
|
|
3418
|
+
: _fetch(url, resolvedOptions));
|
|
3160
3419
|
|
|
3161
|
-
const isStreamResponse =
|
|
3420
|
+
const isStreamResponse =
|
|
3421
|
+
supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
3162
3422
|
|
|
3163
3423
|
if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
|
|
3164
3424
|
const options = {};
|
|
3165
3425
|
|
|
3166
|
-
['status', 'statusText', 'headers'].forEach(prop => {
|
|
3426
|
+
['status', 'statusText', 'headers'].forEach((prop) => {
|
|
3167
3427
|
options[prop] = response[prop];
|
|
3168
3428
|
});
|
|
3169
3429
|
|
|
3170
3430
|
const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
|
|
3171
3431
|
|
|
3172
|
-
const [onProgress, flush] =
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3432
|
+
const [onProgress, flush] =
|
|
3433
|
+
(onDownloadProgress &&
|
|
3434
|
+
progressEventDecorator(
|
|
3435
|
+
responseContentLength,
|
|
3436
|
+
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
3437
|
+
)) ||
|
|
3438
|
+
[];
|
|
3176
3439
|
|
|
3177
3440
|
response = new Response(
|
|
3178
3441
|
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
@@ -3185,7 +3448,10 @@ const factory = (env) => {
|
|
|
3185
3448
|
|
|
3186
3449
|
responseType = responseType || 'text';
|
|
3187
3450
|
|
|
3188
|
-
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](
|
|
3451
|
+
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](
|
|
3452
|
+
response,
|
|
3453
|
+
config
|
|
3454
|
+
);
|
|
3189
3455
|
|
|
3190
3456
|
!isStreamResponse && unsubscribe && unsubscribe();
|
|
3191
3457
|
|
|
@@ -3196,43 +3462,50 @@ const factory = (env) => {
|
|
|
3196
3462
|
status: response.status,
|
|
3197
3463
|
statusText: response.statusText,
|
|
3198
3464
|
config,
|
|
3199
|
-
request
|
|
3465
|
+
request,
|
|
3200
3466
|
});
|
|
3201
|
-
})
|
|
3467
|
+
});
|
|
3202
3468
|
} catch (err) {
|
|
3203
3469
|
unsubscribe && unsubscribe();
|
|
3204
3470
|
|
|
3205
3471
|
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
|
3206
3472
|
throw Object.assign(
|
|
3207
|
-
new AxiosError$1(
|
|
3473
|
+
new AxiosError$1(
|
|
3474
|
+
'Network Error',
|
|
3475
|
+
AxiosError$1.ERR_NETWORK,
|
|
3476
|
+
config,
|
|
3477
|
+
request,
|
|
3478
|
+
err && err.response
|
|
3479
|
+
),
|
|
3208
3480
|
{
|
|
3209
|
-
cause: err.cause || err
|
|
3481
|
+
cause: err.cause || err,
|
|
3210
3482
|
}
|
|
3211
|
-
)
|
|
3483
|
+
);
|
|
3212
3484
|
}
|
|
3213
3485
|
|
|
3214
3486
|
throw AxiosError$1.from(err, err && err.code, config, request, err && err.response);
|
|
3215
3487
|
}
|
|
3216
|
-
}
|
|
3488
|
+
};
|
|
3217
3489
|
};
|
|
3218
3490
|
|
|
3219
3491
|
const seedCache = new Map();
|
|
3220
3492
|
|
|
3221
3493
|
const getFetch = (config) => {
|
|
3222
3494
|
let env = (config && config.env) || {};
|
|
3223
|
-
const {fetch, Request, Response} = env;
|
|
3224
|
-
const seeds = [
|
|
3225
|
-
Request, Response, fetch
|
|
3226
|
-
];
|
|
3495
|
+
const { fetch, Request, Response } = env;
|
|
3496
|
+
const seeds = [Request, Response, fetch];
|
|
3227
3497
|
|
|
3228
|
-
let len = seeds.length,
|
|
3229
|
-
|
|
3498
|
+
let len = seeds.length,
|
|
3499
|
+
i = len,
|
|
3500
|
+
seed,
|
|
3501
|
+
target,
|
|
3502
|
+
map = seedCache;
|
|
3230
3503
|
|
|
3231
3504
|
while (i--) {
|
|
3232
3505
|
seed = seeds[i];
|
|
3233
3506
|
target = map.get(seed);
|
|
3234
3507
|
|
|
3235
|
-
target === undefined && map.set(seed, target =
|
|
3508
|
+
target === undefined && map.set(seed, (target = i ? new Map() : factory(env)));
|
|
3236
3509
|
|
|
3237
3510
|
map = target;
|
|
3238
3511
|
}
|
|
@@ -3248,7 +3521,7 @@ getFetch();
|
|
|
3248
3521
|
* - `http` for Node.js
|
|
3249
3522
|
* - `xhr` for browsers
|
|
3250
3523
|
* - `fetch` for fetch API-based requests
|
|
3251
|
-
*
|
|
3524
|
+
*
|
|
3252
3525
|
* @type {Object<string, Function|Object>}
|
|
3253
3526
|
*/
|
|
3254
3527
|
const knownAdapters = {
|
|
@@ -3256,7 +3529,7 @@ const knownAdapters = {
|
|
|
3256
3529
|
xhr: xhrAdapter,
|
|
3257
3530
|
fetch: {
|
|
3258
3531
|
get: getFetch,
|
|
3259
|
-
}
|
|
3532
|
+
},
|
|
3260
3533
|
};
|
|
3261
3534
|
|
|
3262
3535
|
// Assign adapter names for easier debugging and identification
|
|
@@ -3273,7 +3546,7 @@ utils$1.forEach(knownAdapters, (fn, value) => {
|
|
|
3273
3546
|
|
|
3274
3547
|
/**
|
|
3275
3548
|
* Render a rejection reason string for unknown or unsupported adapters
|
|
3276
|
-
*
|
|
3549
|
+
*
|
|
3277
3550
|
* @param {string} reason
|
|
3278
3551
|
* @returns {string}
|
|
3279
3552
|
*/
|
|
@@ -3281,17 +3554,18 @@ const renderReason = (reason) => `- ${reason}`;
|
|
|
3281
3554
|
|
|
3282
3555
|
/**
|
|
3283
3556
|
* Check if the adapter is resolved (function, null, or false)
|
|
3284
|
-
*
|
|
3557
|
+
*
|
|
3285
3558
|
* @param {Function|null|false} adapter
|
|
3286
3559
|
* @returns {boolean}
|
|
3287
3560
|
*/
|
|
3288
|
-
const isResolvedHandle = (adapter) =>
|
|
3561
|
+
const isResolvedHandle = (adapter) =>
|
|
3562
|
+
utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
3289
3563
|
|
|
3290
3564
|
/**
|
|
3291
3565
|
* Get the first suitable adapter from the provided list.
|
|
3292
3566
|
* Tries each adapter in order until a supported one is found.
|
|
3293
3567
|
* Throws an AxiosError if no adapter is suitable.
|
|
3294
|
-
*
|
|
3568
|
+
*
|
|
3295
3569
|
* @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
|
|
3296
3570
|
* @param {Object} config - Axios request configuration
|
|
3297
3571
|
* @throws {AxiosError} If no suitable adapter is available
|
|
@@ -3328,14 +3602,17 @@ function getAdapter$1(adapters, config) {
|
|
|
3328
3602
|
}
|
|
3329
3603
|
|
|
3330
3604
|
if (!adapter) {
|
|
3331
|
-
const reasons = Object.entries(rejectedReasons)
|
|
3332
|
-
|
|
3605
|
+
const reasons = Object.entries(rejectedReasons).map(
|
|
3606
|
+
([id, state]) =>
|
|
3607
|
+
`adapter ${id} ` +
|
|
3333
3608
|
(state === false ? 'is not supported by the environment' : 'is not available in the build')
|
|
3334
|
-
|
|
3609
|
+
);
|
|
3335
3610
|
|
|
3336
|
-
let s = length
|
|
3337
|
-
|
|
3338
|
-
|
|
3611
|
+
let s = length
|
|
3612
|
+
? reasons.length > 1
|
|
3613
|
+
? 'since :\n' + reasons.map(renderReason).join('\n')
|
|
3614
|
+
: ' ' + renderReason(reasons[0])
|
|
3615
|
+
: 'as no adapter specified';
|
|
3339
3616
|
|
|
3340
3617
|
throw new AxiosError$1(
|
|
3341
3618
|
`There is no suitable adapter to dispatch the request ` + s,
|
|
@@ -3360,7 +3637,7 @@ var adapters = {
|
|
|
3360
3637
|
* Exposes all known adapters
|
|
3361
3638
|
* @type {Object<string, Function|Object>}
|
|
3362
3639
|
*/
|
|
3363
|
-
adapters: knownAdapters
|
|
3640
|
+
adapters: knownAdapters,
|
|
3364
3641
|
};
|
|
3365
3642
|
|
|
3366
3643
|
/**
|
|
@@ -3393,10 +3670,7 @@ function dispatchRequest(config) {
|
|
|
3393
3670
|
config.headers = AxiosHeaders$1.from(config.headers);
|
|
3394
3671
|
|
|
3395
3672
|
// Transform request data
|
|
3396
|
-
config.data = transformData.call(
|
|
3397
|
-
config,
|
|
3398
|
-
config.transformRequest
|
|
3399
|
-
);
|
|
3673
|
+
config.data = transformData.call(config, config.transformRequest);
|
|
3400
3674
|
|
|
3401
3675
|
if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
|
|
3402
3676
|
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
|
@@ -3404,39 +3678,38 @@ function dispatchRequest(config) {
|
|
|
3404
3678
|
|
|
3405
3679
|
const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
|
|
3406
3680
|
|
|
3407
|
-
return adapter(config).then(
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
// Transform response data
|
|
3411
|
-
response.data = transformData.call(
|
|
3412
|
-
config,
|
|
3413
|
-
config.transformResponse,
|
|
3414
|
-
response
|
|
3415
|
-
);
|
|
3416
|
-
|
|
3417
|
-
response.headers = AxiosHeaders$1.from(response.headers);
|
|
3418
|
-
|
|
3419
|
-
return response;
|
|
3420
|
-
}, function onAdapterRejection(reason) {
|
|
3421
|
-
if (!isCancel$1(reason)) {
|
|
3681
|
+
return adapter(config).then(
|
|
3682
|
+
function onAdapterResolution(response) {
|
|
3422
3683
|
throwIfCancellationRequested(config);
|
|
3423
3684
|
|
|
3424
3685
|
// Transform response data
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3686
|
+
response.data = transformData.call(config, config.transformResponse, response);
|
|
3687
|
+
|
|
3688
|
+
response.headers = AxiosHeaders$1.from(response.headers);
|
|
3689
|
+
|
|
3690
|
+
return response;
|
|
3691
|
+
},
|
|
3692
|
+
function onAdapterRejection(reason) {
|
|
3693
|
+
if (!isCancel$1(reason)) {
|
|
3694
|
+
throwIfCancellationRequested(config);
|
|
3695
|
+
|
|
3696
|
+
// Transform response data
|
|
3697
|
+
if (reason && reason.response) {
|
|
3698
|
+
reason.response.data = transformData.call(
|
|
3699
|
+
config,
|
|
3700
|
+
config.transformResponse,
|
|
3701
|
+
reason.response
|
|
3702
|
+
);
|
|
3703
|
+
reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
|
|
3704
|
+
}
|
|
3432
3705
|
}
|
|
3433
|
-
}
|
|
3434
3706
|
|
|
3435
|
-
|
|
3436
|
-
|
|
3707
|
+
return Promise.reject(reason);
|
|
3708
|
+
}
|
|
3709
|
+
);
|
|
3437
3710
|
}
|
|
3438
3711
|
|
|
3439
|
-
const VERSION$1 = "1.
|
|
3712
|
+
const VERSION$1 = "1.15.0";
|
|
3440
3713
|
|
|
3441
3714
|
const validators$1 = {};
|
|
3442
3715
|
|
|
@@ -3460,7 +3733,15 @@ const deprecatedWarnings = {};
|
|
|
3460
3733
|
*/
|
|
3461
3734
|
validators$1.transitional = function transitional(validator, version, message) {
|
|
3462
3735
|
function formatMessage(opt, desc) {
|
|
3463
|
-
return
|
|
3736
|
+
return (
|
|
3737
|
+
'[Axios v' +
|
|
3738
|
+
VERSION$1 +
|
|
3739
|
+
"] Transitional option '" +
|
|
3740
|
+
opt +
|
|
3741
|
+
"'" +
|
|
3742
|
+
desc +
|
|
3743
|
+
(message ? '. ' + message : '')
|
|
3744
|
+
);
|
|
3464
3745
|
}
|
|
3465
3746
|
|
|
3466
3747
|
// eslint-disable-next-line func-names
|
|
@@ -3492,7 +3773,7 @@ validators$1.spelling = function spelling(correctSpelling) {
|
|
|
3492
3773
|
// eslint-disable-next-line no-console
|
|
3493
3774
|
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
|
|
3494
3775
|
return true;
|
|
3495
|
-
}
|
|
3776
|
+
};
|
|
3496
3777
|
};
|
|
3497
3778
|
|
|
3498
3779
|
/**
|
|
@@ -3518,7 +3799,10 @@ function assertOptions(options, schema, allowUnknown) {
|
|
|
3518
3799
|
const value = options[opt];
|
|
3519
3800
|
const result = value === undefined || validator(value, opt, options);
|
|
3520
3801
|
if (result !== true) {
|
|
3521
|
-
throw new AxiosError$1(
|
|
3802
|
+
throw new AxiosError$1(
|
|
3803
|
+
'option ' + opt + ' must be ' + result,
|
|
3804
|
+
AxiosError$1.ERR_BAD_OPTION_VALUE
|
|
3805
|
+
);
|
|
3522
3806
|
}
|
|
3523
3807
|
continue;
|
|
3524
3808
|
}
|
|
@@ -3530,7 +3814,7 @@ function assertOptions(options, schema, allowUnknown) {
|
|
|
3530
3814
|
|
|
3531
3815
|
var validator = {
|
|
3532
3816
|
assertOptions,
|
|
3533
|
-
validators: validators$1
|
|
3817
|
+
validators: validators$1,
|
|
3534
3818
|
};
|
|
3535
3819
|
|
|
3536
3820
|
const validators = validator.validators;
|
|
@@ -3547,7 +3831,7 @@ let Axios$1 = class Axios {
|
|
|
3547
3831
|
this.defaults = instanceConfig || {};
|
|
3548
3832
|
this.interceptors = {
|
|
3549
3833
|
request: new InterceptorManager(),
|
|
3550
|
-
response: new InterceptorManager()
|
|
3834
|
+
response: new InterceptorManager(),
|
|
3551
3835
|
};
|
|
3552
3836
|
}
|
|
3553
3837
|
|
|
@@ -3569,13 +3853,29 @@ let Axios$1 = class Axios {
|
|
|
3569
3853
|
Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
|
|
3570
3854
|
|
|
3571
3855
|
// slice off the Error: ... line
|
|
3572
|
-
const stack =
|
|
3856
|
+
const stack = (() => {
|
|
3857
|
+
if (!dummy.stack) {
|
|
3858
|
+
return '';
|
|
3859
|
+
}
|
|
3860
|
+
|
|
3861
|
+
const firstNewlineIndex = dummy.stack.indexOf('\n');
|
|
3862
|
+
|
|
3863
|
+
return firstNewlineIndex === -1 ? '' : dummy.stack.slice(firstNewlineIndex + 1);
|
|
3864
|
+
})();
|
|
3573
3865
|
try {
|
|
3574
3866
|
if (!err.stack) {
|
|
3575
3867
|
err.stack = stack;
|
|
3576
3868
|
// match without the 2 top stack lines
|
|
3577
|
-
} else if (stack
|
|
3578
|
-
|
|
3869
|
+
} else if (stack) {
|
|
3870
|
+
const firstNewlineIndex = stack.indexOf('\n');
|
|
3871
|
+
const secondNewlineIndex =
|
|
3872
|
+
firstNewlineIndex === -1 ? -1 : stack.indexOf('\n', firstNewlineIndex + 1);
|
|
3873
|
+
const stackWithoutTwoTopLines =
|
|
3874
|
+
secondNewlineIndex === -1 ? '' : stack.slice(secondNewlineIndex + 1);
|
|
3875
|
+
|
|
3876
|
+
if (!String(err.stack).endsWith(stackWithoutTwoTopLines)) {
|
|
3877
|
+
err.stack += '\n' + stack;
|
|
3878
|
+
}
|
|
3579
3879
|
}
|
|
3580
3880
|
} catch (e) {
|
|
3581
3881
|
// ignore the case where "stack" is an un-writable property
|
|
@@ -3598,27 +3898,35 @@ let Axios$1 = class Axios {
|
|
|
3598
3898
|
|
|
3599
3899
|
config = mergeConfig$1(this.defaults, config);
|
|
3600
3900
|
|
|
3601
|
-
const {transitional, paramsSerializer, headers} = config;
|
|
3901
|
+
const { transitional, paramsSerializer, headers } = config;
|
|
3602
3902
|
|
|
3603
3903
|
if (transitional !== undefined) {
|
|
3604
|
-
validator.assertOptions(
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3904
|
+
validator.assertOptions(
|
|
3905
|
+
transitional,
|
|
3906
|
+
{
|
|
3907
|
+
silentJSONParsing: validators.transitional(validators.boolean),
|
|
3908
|
+
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
3909
|
+
clarifyTimeoutError: validators.transitional(validators.boolean),
|
|
3910
|
+
legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
|
|
3911
|
+
},
|
|
3912
|
+
false
|
|
3913
|
+
);
|
|
3610
3914
|
}
|
|
3611
3915
|
|
|
3612
3916
|
if (paramsSerializer != null) {
|
|
3613
3917
|
if (utils$1.isFunction(paramsSerializer)) {
|
|
3614
3918
|
config.paramsSerializer = {
|
|
3615
|
-
serialize: paramsSerializer
|
|
3919
|
+
serialize: paramsSerializer,
|
|
3616
3920
|
};
|
|
3617
3921
|
} else {
|
|
3618
|
-
validator.assertOptions(
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3922
|
+
validator.assertOptions(
|
|
3923
|
+
paramsSerializer,
|
|
3924
|
+
{
|
|
3925
|
+
encode: validators.function,
|
|
3926
|
+
serialize: validators.function,
|
|
3927
|
+
},
|
|
3928
|
+
true
|
|
3929
|
+
);
|
|
3622
3930
|
}
|
|
3623
3931
|
}
|
|
3624
3932
|
|
|
@@ -3629,26 +3937,25 @@ let Axios$1 = class Axios {
|
|
|
3629
3937
|
config.allowAbsoluteUrls = true;
|
|
3630
3938
|
}
|
|
3631
3939
|
|
|
3632
|
-
validator.assertOptions(
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3940
|
+
validator.assertOptions(
|
|
3941
|
+
config,
|
|
3942
|
+
{
|
|
3943
|
+
baseUrl: validators.spelling('baseURL'),
|
|
3944
|
+
withXsrfToken: validators.spelling('withXSRFToken'),
|
|
3945
|
+
},
|
|
3946
|
+
true
|
|
3947
|
+
);
|
|
3636
3948
|
|
|
3637
3949
|
// Set config.method
|
|
3638
3950
|
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
|
3639
3951
|
|
|
3640
3952
|
// Flatten headers
|
|
3641
|
-
let contextHeaders = headers && utils$1.merge(
|
|
3642
|
-
headers.common,
|
|
3643
|
-
headers[config.method]
|
|
3644
|
-
);
|
|
3953
|
+
let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
|
|
3645
3954
|
|
|
3646
|
-
headers &&
|
|
3647
|
-
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
|
3648
|
-
(method) => {
|
|
3955
|
+
headers &&
|
|
3956
|
+
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], (method) => {
|
|
3649
3957
|
delete headers[method];
|
|
3650
|
-
}
|
|
3651
|
-
);
|
|
3958
|
+
});
|
|
3652
3959
|
|
|
3653
3960
|
config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
|
|
3654
3961
|
|
|
@@ -3663,7 +3970,8 @@ let Axios$1 = class Axios {
|
|
|
3663
3970
|
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
3664
3971
|
|
|
3665
3972
|
const transitional = config.transitional || transitionalDefaults;
|
|
3666
|
-
const legacyInterceptorReqResOrdering =
|
|
3973
|
+
const legacyInterceptorReqResOrdering =
|
|
3974
|
+
transitional && transitional.legacyInterceptorReqResOrdering;
|
|
3667
3975
|
|
|
3668
3976
|
if (legacyInterceptorReqResOrdering) {
|
|
3669
3977
|
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
@@ -3737,28 +4045,32 @@ let Axios$1 = class Axios {
|
|
|
3737
4045
|
// Provide aliases for supported request methods
|
|
3738
4046
|
utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
|
3739
4047
|
/*eslint func-names:0*/
|
|
3740
|
-
Axios$1.prototype[method] = function(url, config) {
|
|
3741
|
-
return this.request(
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
4048
|
+
Axios$1.prototype[method] = function (url, config) {
|
|
4049
|
+
return this.request(
|
|
4050
|
+
mergeConfig$1(config || {}, {
|
|
4051
|
+
method,
|
|
4052
|
+
url,
|
|
4053
|
+
data: (config || {}).data,
|
|
4054
|
+
})
|
|
4055
|
+
);
|
|
3746
4056
|
};
|
|
3747
4057
|
});
|
|
3748
4058
|
|
|
3749
4059
|
utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
3750
|
-
/*eslint func-names:0*/
|
|
3751
|
-
|
|
3752
4060
|
function generateHTTPMethod(isForm) {
|
|
3753
4061
|
return function httpMethod(url, data, config) {
|
|
3754
|
-
return this.request(
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
4062
|
+
return this.request(
|
|
4063
|
+
mergeConfig$1(config || {}, {
|
|
4064
|
+
method,
|
|
4065
|
+
headers: isForm
|
|
4066
|
+
? {
|
|
4067
|
+
'Content-Type': 'multipart/form-data',
|
|
4068
|
+
}
|
|
4069
|
+
: {},
|
|
4070
|
+
url,
|
|
4071
|
+
data,
|
|
4072
|
+
})
|
|
4073
|
+
);
|
|
3762
4074
|
};
|
|
3763
4075
|
}
|
|
3764
4076
|
|
|
@@ -3789,7 +4101,7 @@ let CancelToken$1 = class CancelToken {
|
|
|
3789
4101
|
const token = this;
|
|
3790
4102
|
|
|
3791
4103
|
// eslint-disable-next-line func-names
|
|
3792
|
-
this.promise.then(cancel => {
|
|
4104
|
+
this.promise.then((cancel) => {
|
|
3793
4105
|
if (!token._listeners) return;
|
|
3794
4106
|
|
|
3795
4107
|
let i = token._listeners.length;
|
|
@@ -3801,10 +4113,10 @@ let CancelToken$1 = class CancelToken {
|
|
|
3801
4113
|
});
|
|
3802
4114
|
|
|
3803
4115
|
// eslint-disable-next-line func-names
|
|
3804
|
-
this.promise.then = onfulfilled => {
|
|
4116
|
+
this.promise.then = (onfulfilled) => {
|
|
3805
4117
|
let _resolve;
|
|
3806
4118
|
// eslint-disable-next-line func-names
|
|
3807
|
-
const promise = new Promise(resolve => {
|
|
4119
|
+
const promise = new Promise((resolve) => {
|
|
3808
4120
|
token.subscribe(resolve);
|
|
3809
4121
|
_resolve = resolve;
|
|
3810
4122
|
}).then(onfulfilled);
|
|
@@ -3892,7 +4204,7 @@ let CancelToken$1 = class CancelToken {
|
|
|
3892
4204
|
});
|
|
3893
4205
|
return {
|
|
3894
4206
|
token,
|
|
3895
|
-
cancel
|
|
4207
|
+
cancel,
|
|
3896
4208
|
};
|
|
3897
4209
|
}
|
|
3898
4210
|
};
|
|
@@ -3932,7 +4244,7 @@ function spread$1(callback) {
|
|
|
3932
4244
|
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
|
3933
4245
|
*/
|
|
3934
4246
|
function isAxiosError$1(payload) {
|
|
3935
|
-
return utils$1.isObject(payload) &&
|
|
4247
|
+
return utils$1.isObject(payload) && payload.isAxiosError === true;
|
|
3936
4248
|
}
|
|
3937
4249
|
|
|
3938
4250
|
const HttpStatusCode$1 = {
|
|
@@ -4023,10 +4335,10 @@ function createInstance(defaultConfig) {
|
|
|
4023
4335
|
const instance = bind(Axios$1.prototype.request, context);
|
|
4024
4336
|
|
|
4025
4337
|
// Copy axios.prototype to instance
|
|
4026
|
-
utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
|
|
4338
|
+
utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
|
|
4027
4339
|
|
|
4028
4340
|
// Copy context to instance
|
|
4029
|
-
utils$1.extend(instance, context, null, {allOwnKeys: true});
|
|
4341
|
+
utils$1.extend(instance, context, null, { allOwnKeys: true });
|
|
4030
4342
|
|
|
4031
4343
|
// Factory for creating new instances
|
|
4032
4344
|
instance.create = function create(instanceConfig) {
|
|
@@ -4070,7 +4382,7 @@ axios.mergeConfig = mergeConfig$1;
|
|
|
4070
4382
|
|
|
4071
4383
|
axios.AxiosHeaders = AxiosHeaders$1;
|
|
4072
4384
|
|
|
4073
|
-
axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
4385
|
+
axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
4074
4386
|
|
|
4075
4387
|
axios.getAdapter = adapters.getAdapter;
|
|
4076
4388
|
|
|
@@ -4097,7 +4409,7 @@ const {
|
|
|
4097
4409
|
HttpStatusCode,
|
|
4098
4410
|
formToJSON,
|
|
4099
4411
|
getAdapter,
|
|
4100
|
-
mergeConfig
|
|
4412
|
+
mergeConfig,
|
|
4101
4413
|
} = axios;
|
|
4102
4414
|
|
|
4103
4415
|
/**
|