@oiz/stzh-components 4.4.2 → 4.4.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/dist/cjs/{app-globals-14d9de84.js → app-globals-f41fe9b1.js} +2 -2
- package/dist/cjs/{app-globals-14d9de84.js.map → app-globals-f41fe9b1.js.map} +1 -1
- package/dist/cjs/{axios-0a08e254.js → axios-7101b594.js} +361 -229
- package/dist/cjs/axios-7101b594.js.map +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/stzh-bathstatus-list.cjs.entry.js +1 -1
- package/dist/cjs/stzh-components.cjs.js +1 -1
- package/dist/cjs/stzh-microsite-teaserlist.cjs.entry.js +1 -1
- package/dist/cjs/stzh-poilist.cjs.entry.js +1 -1
- package/dist/cjs/stzh-search.cjs.entry.js +1 -1
- package/dist/cjs/stzh-vbz-majorticker.cjs.entry.js +1 -1
- package/dist/cjs/stzh-vbz-ticker.cjs.entry.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/{p-1b0f45c6.js → p-30d100f4.js} +361 -229
- package/dist/components/p-30d100f4.js.map +1 -0
- package/dist/components/stzh-bathstatus-list.js +1 -1
- package/dist/components/stzh-microsite-teaserlist.js +1 -1
- package/dist/components/stzh-poilist.js +1 -1
- package/dist/components/stzh-search.js +1 -1
- package/dist/components/stzh-vbz-majorticker.js +1 -1
- package/dist/components/stzh-vbz-ticker.js +1 -1
- package/dist/esm/{app-globals-611adbd0.js → app-globals-4d8695ba.js} +2 -2
- package/dist/esm/{app-globals-611adbd0.js.map → app-globals-4d8695ba.js.map} +1 -1
- package/dist/esm/{axios-8bc4215c.js → axios-b144d3e0.js} +361 -229
- package/dist/esm/axios-b144d3e0.js.map +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/stzh-bathstatus-list.entry.js +1 -1
- package/dist/esm/stzh-components.js +1 -1
- package/dist/esm/stzh-microsite-teaserlist.entry.js +1 -1
- package/dist/esm/stzh-poilist.entry.js +1 -1
- package/dist/esm/stzh-search.entry.js +1 -1
- package/dist/esm/stzh-vbz-majorticker.entry.js +1 -1
- package/dist/esm/stzh-vbz-ticker.entry.js +1 -1
- package/dist/stzh-components/p-30d100f4.js +2 -0
- package/dist/stzh-components/p-30d100f4.js.map +1 -0
- package/dist/stzh-components/p-357ce1c2.entry.js +2 -0
- package/dist/stzh-components/{p-435f3927.entry.js.map → p-357ce1c2.entry.js.map} +1 -1
- package/dist/stzh-components/{p-7be5d916.entry.js → p-81223fd0.entry.js} +2 -2
- package/dist/stzh-components/{p-d08a74fe.entry.js → p-98eb5017.entry.js} +2 -2
- package/dist/stzh-components/{p-97a6fbc6.entry.js → p-a45f19b5.entry.js} +2 -2
- package/dist/stzh-components/{p-035cdba2.entry.js → p-adcf8c10.entry.js} +2 -2
- package/dist/stzh-components/{p-c6a770a6.js → p-bac2e98e.js} +2 -2
- package/dist/stzh-components/{p-ec1efeb8.entry.js → p-d71d4d86.entry.js} +2 -2
- package/dist/stzh-components/stzh-components.esm.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/axios-0a08e254.js.map +0 -1
- package/dist/components/p-1b0f45c6.js.map +0 -1
- package/dist/esm/axios-8bc4215c.js.map +0 -1
- package/dist/stzh-components/p-1b0f45c6.js +0 -2
- package/dist/stzh-components/p-1b0f45c6.js.map +0 -1
- package/dist/stzh-components/p-435f3927.entry.js +0 -2
- /package/dist/stzh-components/{p-7be5d916.entry.js.map → p-81223fd0.entry.js.map} +0 -0
- /package/dist/stzh-components/{p-d08a74fe.entry.js.map → p-98eb5017.entry.js.map} +0 -0
- /package/dist/stzh-components/{p-97a6fbc6.entry.js.map → p-a45f19b5.entry.js.map} +0 -0
- /package/dist/stzh-components/{p-035cdba2.entry.js.map → p-adcf8c10.entry.js.map} +0 -0
- /package/dist/stzh-components/{p-c6a770a6.js.map → p-bac2e98e.js.map} +0 -0
- /package/dist/stzh-components/{p-ec1efeb8.entry.js.map → p-d71d4d86.entry.js.map} +0 -0
|
@@ -8,6 +8,7 @@ function bind(fn, thisArg) {
|
|
|
8
8
|
|
|
9
9
|
const {toString} = Object.prototype;
|
|
10
10
|
const {getPrototypeOf} = Object;
|
|
11
|
+
const {iterator, toStringTag} = Symbol;
|
|
11
12
|
|
|
12
13
|
const kindOf = (cache => thing => {
|
|
13
14
|
const str = toString.call(thing);
|
|
@@ -48,7 +49,7 @@ const isUndefined = typeOfTest('undefined');
|
|
|
48
49
|
*/
|
|
49
50
|
function isBuffer(val) {
|
|
50
51
|
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
|
|
51
|
-
&& isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
52
|
+
&& isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
/**
|
|
@@ -93,7 +94,7 @@ const isString = typeOfTest('string');
|
|
|
93
94
|
* @param {*} val The value to test
|
|
94
95
|
* @returns {boolean} True if value is a Function, otherwise false
|
|
95
96
|
*/
|
|
96
|
-
const isFunction = typeOfTest('function');
|
|
97
|
+
const isFunction$1 = typeOfTest('function');
|
|
97
98
|
|
|
98
99
|
/**
|
|
99
100
|
* Determine if a value is a Number
|
|
@@ -134,7 +135,28 @@ const isPlainObject = (val) => {
|
|
|
134
135
|
}
|
|
135
136
|
|
|
136
137
|
const prototype = getPrototypeOf(val);
|
|
137
|
-
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(
|
|
138
|
+
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Determine if a value is an empty object (safely handles Buffers)
|
|
143
|
+
*
|
|
144
|
+
* @param {*} val The value to test
|
|
145
|
+
*
|
|
146
|
+
* @returns {boolean} True if value is an empty object, otherwise false
|
|
147
|
+
*/
|
|
148
|
+
const isEmptyObject = (val) => {
|
|
149
|
+
// Early return for non-objects or Buffers to prevent RangeError
|
|
150
|
+
if (!isObject(val) || isBuffer(val)) {
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
try {
|
|
155
|
+
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
|
156
|
+
} catch (e) {
|
|
157
|
+
// Fallback for any other objects that might cause RangeError with Object.keys()
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
138
160
|
};
|
|
139
161
|
|
|
140
162
|
/**
|
|
@@ -180,7 +202,7 @@ const isFileList = kindOfTest('FileList');
|
|
|
180
202
|
*
|
|
181
203
|
* @returns {boolean} True if value is a Stream, otherwise false
|
|
182
204
|
*/
|
|
183
|
-
const isStream = (val) => isObject(val) && isFunction(val.pipe);
|
|
205
|
+
const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
|
|
184
206
|
|
|
185
207
|
/**
|
|
186
208
|
* Determine if a value is a FormData
|
|
@@ -193,10 +215,10 @@ const isFormData = (thing) => {
|
|
|
193
215
|
let kind;
|
|
194
216
|
return thing && (
|
|
195
217
|
(typeof FormData === 'function' && thing instanceof FormData) || (
|
|
196
|
-
isFunction(thing.append) && (
|
|
218
|
+
isFunction$1(thing.append) && (
|
|
197
219
|
(kind = kindOf(thing)) === 'formdata' ||
|
|
198
220
|
// detect form-data instance
|
|
199
|
-
(kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')
|
|
221
|
+
(kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
|
|
200
222
|
)
|
|
201
223
|
)
|
|
202
224
|
)
|
|
@@ -259,6 +281,11 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
|
259
281
|
fn.call(null, obj[i], i, obj);
|
|
260
282
|
}
|
|
261
283
|
} else {
|
|
284
|
+
// Buffer check
|
|
285
|
+
if (isBuffer(obj)) {
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
|
|
262
289
|
// Iterate over object keys
|
|
263
290
|
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
264
291
|
const len = keys.length;
|
|
@@ -272,6 +299,10 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
|
272
299
|
}
|
|
273
300
|
|
|
274
301
|
function findKey(obj, key) {
|
|
302
|
+
if (isBuffer(obj)){
|
|
303
|
+
return null;
|
|
304
|
+
}
|
|
305
|
+
|
|
275
306
|
key = key.toLowerCase();
|
|
276
307
|
const keys = Object.keys(obj);
|
|
277
308
|
let i = keys.length;
|
|
@@ -312,7 +343,7 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
|
|
|
312
343
|
* @returns {Object} Result of all merge properties
|
|
313
344
|
*/
|
|
314
345
|
function merge(/* obj1, obj2, obj3, ... */) {
|
|
315
|
-
const {caseless} = isContextDefined(this) && this || {};
|
|
346
|
+
const {caseless, skipUndefined} = isContextDefined(this) && this || {};
|
|
316
347
|
const result = {};
|
|
317
348
|
const assignValue = (val, key) => {
|
|
318
349
|
const targetKey = caseless && findKey(result, key) || key;
|
|
@@ -322,7 +353,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
322
353
|
result[targetKey] = merge({}, val);
|
|
323
354
|
} else if (isArray(val)) {
|
|
324
355
|
result[targetKey] = val.slice();
|
|
325
|
-
} else {
|
|
356
|
+
} else if (!skipUndefined || !isUndefined(val)) {
|
|
326
357
|
result[targetKey] = val;
|
|
327
358
|
}
|
|
328
359
|
};
|
|
@@ -345,7 +376,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
345
376
|
*/
|
|
346
377
|
const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
|
|
347
378
|
forEach(b, (val, key) => {
|
|
348
|
-
if (thisArg && isFunction(val)) {
|
|
379
|
+
if (thisArg && isFunction$1(val)) {
|
|
349
380
|
a[key] = bind(val, thisArg);
|
|
350
381
|
} else {
|
|
351
382
|
a[key] = val;
|
|
@@ -485,13 +516,13 @@ const isTypedArray = (TypedArray => {
|
|
|
485
516
|
* @returns {void}
|
|
486
517
|
*/
|
|
487
518
|
const forEachEntry = (obj, fn) => {
|
|
488
|
-
const generator = obj && obj[
|
|
519
|
+
const generator = obj && obj[iterator];
|
|
489
520
|
|
|
490
|
-
const
|
|
521
|
+
const _iterator = generator.call(obj);
|
|
491
522
|
|
|
492
523
|
let result;
|
|
493
524
|
|
|
494
|
-
while ((result =
|
|
525
|
+
while ((result = _iterator.next()) && !result.done) {
|
|
495
526
|
const pair = result.value;
|
|
496
527
|
fn.call(obj, pair[0], pair[1]);
|
|
497
528
|
}
|
|
@@ -561,13 +592,13 @@ const reduceDescriptors = (obj, reducer) => {
|
|
|
561
592
|
const freezeMethods = (obj) => {
|
|
562
593
|
reduceDescriptors(obj, (descriptor, name) => {
|
|
563
594
|
// skip restricted props in strict mode
|
|
564
|
-
if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
|
595
|
+
if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
|
565
596
|
return false;
|
|
566
597
|
}
|
|
567
598
|
|
|
568
599
|
const value = obj[name];
|
|
569
600
|
|
|
570
|
-
if (!isFunction(value)) return;
|
|
601
|
+
if (!isFunction$1(value)) return;
|
|
571
602
|
|
|
572
603
|
descriptor.enumerable = false;
|
|
573
604
|
|
|
@@ -604,6 +635,8 @@ const toFiniteNumber = (value, defaultValue) => {
|
|
|
604
635
|
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
|
|
605
636
|
};
|
|
606
637
|
|
|
638
|
+
|
|
639
|
+
|
|
607
640
|
/**
|
|
608
641
|
* If the thing is a FormData object, return true, otherwise return false.
|
|
609
642
|
*
|
|
@@ -612,7 +645,7 @@ const toFiniteNumber = (value, defaultValue) => {
|
|
|
612
645
|
* @returns {boolean}
|
|
613
646
|
*/
|
|
614
647
|
function isSpecCompliantForm(thing) {
|
|
615
|
-
return !!(thing && isFunction(thing.append) && thing[
|
|
648
|
+
return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
|
|
616
649
|
}
|
|
617
650
|
|
|
618
651
|
const toJSONObject = (obj) => {
|
|
@@ -625,6 +658,11 @@ const toJSONObject = (obj) => {
|
|
|
625
658
|
return;
|
|
626
659
|
}
|
|
627
660
|
|
|
661
|
+
//Buffer check
|
|
662
|
+
if (isBuffer(source)) {
|
|
663
|
+
return source;
|
|
664
|
+
}
|
|
665
|
+
|
|
628
666
|
if(!('toJSON' in source)) {
|
|
629
667
|
stack[i] = source;
|
|
630
668
|
const target = isArray(source) ? [] : {};
|
|
@@ -649,7 +687,7 @@ const toJSONObject = (obj) => {
|
|
|
649
687
|
const isAsyncFn = kindOfTest('AsyncFunction');
|
|
650
688
|
|
|
651
689
|
const isThenable = (thing) =>
|
|
652
|
-
thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
|
|
690
|
+
thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
|
|
653
691
|
|
|
654
692
|
// original code
|
|
655
693
|
// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
|
|
@@ -673,7 +711,7 @@ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
|
673
711
|
})(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
|
|
674
712
|
})(
|
|
675
713
|
typeof setImmediate === 'function',
|
|
676
|
-
isFunction(_global.postMessage)
|
|
714
|
+
isFunction$1(_global.postMessage)
|
|
677
715
|
);
|
|
678
716
|
|
|
679
717
|
const asap = typeof queueMicrotask !== 'undefined' ?
|
|
@@ -681,6 +719,10 @@ const asap = typeof queueMicrotask !== 'undefined' ?
|
|
|
681
719
|
|
|
682
720
|
// *********************
|
|
683
721
|
|
|
722
|
+
|
|
723
|
+
const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
|
|
724
|
+
|
|
725
|
+
|
|
684
726
|
const utils$1 = {
|
|
685
727
|
isArray,
|
|
686
728
|
isArrayBuffer,
|
|
@@ -692,6 +734,7 @@ const utils$1 = {
|
|
|
692
734
|
isBoolean,
|
|
693
735
|
isObject,
|
|
694
736
|
isPlainObject,
|
|
737
|
+
isEmptyObject,
|
|
695
738
|
isReadableStream,
|
|
696
739
|
isRequest,
|
|
697
740
|
isResponse,
|
|
@@ -701,7 +744,7 @@ const utils$1 = {
|
|
|
701
744
|
isFile,
|
|
702
745
|
isBlob,
|
|
703
746
|
isRegExp,
|
|
704
|
-
isFunction,
|
|
747
|
+
isFunction: isFunction$1,
|
|
705
748
|
isStream,
|
|
706
749
|
isURLSearchParams,
|
|
707
750
|
isTypedArray,
|
|
@@ -736,7 +779,8 @@ const utils$1 = {
|
|
|
736
779
|
isAsyncFn,
|
|
737
780
|
isThenable,
|
|
738
781
|
setImmediate: _setImmediate,
|
|
739
|
-
asap
|
|
782
|
+
asap,
|
|
783
|
+
isIterable
|
|
740
784
|
};
|
|
741
785
|
|
|
742
786
|
/**
|
|
@@ -826,11 +870,18 @@ AxiosError.from = (error, code, config, request, response, customProps) => {
|
|
|
826
870
|
return prop !== 'isAxiosError';
|
|
827
871
|
});
|
|
828
872
|
|
|
829
|
-
|
|
873
|
+
const msg = error && error.message ? error.message : 'Error';
|
|
830
874
|
|
|
831
|
-
|
|
875
|
+
// Prefer explicit code; otherwise copy the low-level error's code (e.g. ECONNREFUSED)
|
|
876
|
+
const errCode = code == null && error ? error.code : code;
|
|
877
|
+
AxiosError.call(axiosError, msg, errCode, config, request, response);
|
|
832
878
|
|
|
833
|
-
|
|
879
|
+
// Chain the original error on the standard field; non-enumerable to avoid JSON noise
|
|
880
|
+
if (error && axiosError.cause == null) {
|
|
881
|
+
Object.defineProperty(axiosError, 'cause', { value: error, configurable: true });
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
axiosError.name = (error && error.name) || 'Error';
|
|
834
885
|
|
|
835
886
|
customProps && Object.assign(axiosError, customProps);
|
|
836
887
|
|
|
@@ -955,6 +1006,10 @@ function toFormData(obj, formData, options) {
|
|
|
955
1006
|
return value.toISOString();
|
|
956
1007
|
}
|
|
957
1008
|
|
|
1009
|
+
if (utils$1.isBoolean(value)) {
|
|
1010
|
+
return value.toString();
|
|
1011
|
+
}
|
|
1012
|
+
|
|
958
1013
|
if (!useBlob && utils$1.isBlob(value)) {
|
|
959
1014
|
throw new AxiosError('Blob is not supported. Use a Buffer instead.');
|
|
960
1015
|
}
|
|
@@ -1117,9 +1172,7 @@ function encode(val) {
|
|
|
1117
1172
|
replace(/%3A/gi, ':').
|
|
1118
1173
|
replace(/%24/g, '$').
|
|
1119
1174
|
replace(/%2C/gi, ',').
|
|
1120
|
-
replace(/%20/g, '+')
|
|
1121
|
-
replace(/%5B/gi, '[').
|
|
1122
|
-
replace(/%5D/gi, ']');
|
|
1175
|
+
replace(/%20/g, '+');
|
|
1123
1176
|
}
|
|
1124
1177
|
|
|
1125
1178
|
/**
|
|
@@ -1318,7 +1371,7 @@ const platform = {
|
|
|
1318
1371
|
};
|
|
1319
1372
|
|
|
1320
1373
|
function toURLEncodedForm(data, options) {
|
|
1321
|
-
return toFormData(data, new platform.classes.URLSearchParams(),
|
|
1374
|
+
return toFormData(data, new platform.classes.URLSearchParams(), {
|
|
1322
1375
|
visitor: function(value, key, path, helpers) {
|
|
1323
1376
|
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
1324
1377
|
this.append(key, value.toString('base64'));
|
|
@@ -1326,8 +1379,9 @@ function toURLEncodedForm(data, options) {
|
|
|
1326
1379
|
}
|
|
1327
1380
|
|
|
1328
1381
|
return helpers.defaultVisitor.apply(this, arguments);
|
|
1329
|
-
}
|
|
1330
|
-
|
|
1382
|
+
},
|
|
1383
|
+
...options
|
|
1384
|
+
});
|
|
1331
1385
|
}
|
|
1332
1386
|
|
|
1333
1387
|
/**
|
|
@@ -1523,7 +1577,7 @@ const defaults = {
|
|
|
1523
1577
|
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
1524
1578
|
|
|
1525
1579
|
try {
|
|
1526
|
-
return JSON.parse(data);
|
|
1580
|
+
return JSON.parse(data, this.parseReviver);
|
|
1527
1581
|
} catch (e) {
|
|
1528
1582
|
if (strictJSONParsing) {
|
|
1529
1583
|
if (e.name === 'SyntaxError') {
|
|
@@ -1721,10 +1775,18 @@ class AxiosHeaders {
|
|
|
1721
1775
|
setHeaders(header, valueOrRewrite);
|
|
1722
1776
|
} else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
1723
1777
|
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
1724
|
-
} else if (utils$1.
|
|
1725
|
-
|
|
1726
|
-
|
|
1778
|
+
} else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
|
|
1779
|
+
let obj = {}, dest, key;
|
|
1780
|
+
for (const entry of header) {
|
|
1781
|
+
if (!utils$1.isArray(entry)) {
|
|
1782
|
+
throw TypeError('Object iterator must return a key-value pair');
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1785
|
+
obj[key = entry[0]] = (dest = obj[key]) ?
|
|
1786
|
+
(utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]]) : entry[1];
|
|
1727
1787
|
}
|
|
1788
|
+
|
|
1789
|
+
setHeaders(obj, valueOrRewrite);
|
|
1728
1790
|
} else {
|
|
1729
1791
|
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
1730
1792
|
}
|
|
@@ -1866,6 +1928,10 @@ class AxiosHeaders {
|
|
|
1866
1928
|
return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
|
|
1867
1929
|
}
|
|
1868
1930
|
|
|
1931
|
+
getSetCookie() {
|
|
1932
|
+
return this.get("set-cookie") || [];
|
|
1933
|
+
}
|
|
1934
|
+
|
|
1869
1935
|
get [Symbol.toStringTag]() {
|
|
1870
1936
|
return 'AxiosHeaders';
|
|
1871
1937
|
}
|
|
@@ -2068,7 +2134,7 @@ function throttle(fn, freq) {
|
|
|
2068
2134
|
clearTimeout(timer);
|
|
2069
2135
|
timer = null;
|
|
2070
2136
|
}
|
|
2071
|
-
fn
|
|
2137
|
+
fn(...args);
|
|
2072
2138
|
};
|
|
2073
2139
|
|
|
2074
2140
|
const throttled = (...args) => {
|
|
@@ -2225,7 +2291,7 @@ function combineURLs(baseURL, relativeURL) {
|
|
|
2225
2291
|
*/
|
|
2226
2292
|
function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
2227
2293
|
let isRelativeUrl = !isAbsoluteURL(requestedURL);
|
|
2228
|
-
if (baseURL && isRelativeUrl || allowAbsoluteUrls == false) {
|
|
2294
|
+
if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
|
|
2229
2295
|
return combineURLs(baseURL, requestedURL);
|
|
2230
2296
|
}
|
|
2231
2297
|
return requestedURL;
|
|
@@ -2324,7 +2390,7 @@ function mergeConfig(config1, config2) {
|
|
|
2324
2390
|
headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
|
|
2325
2391
|
};
|
|
2326
2392
|
|
|
2327
|
-
utils$1.forEach(Object.keys(
|
|
2393
|
+
utils$1.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
|
|
2328
2394
|
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
2329
2395
|
const configValue = merge(config1[prop], config2[prop], prop);
|
|
2330
2396
|
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
@@ -2336,11 +2402,11 @@ function mergeConfig(config1, config2) {
|
|
|
2336
2402
|
const resolveConfig = (config) => {
|
|
2337
2403
|
const newConfig = mergeConfig({}, config);
|
|
2338
2404
|
|
|
2339
|
-
let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
|
|
2405
|
+
let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
|
|
2340
2406
|
|
|
2341
2407
|
newConfig.headers = headers = AxiosHeaders$1.from(headers);
|
|
2342
2408
|
|
|
2343
|
-
newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
|
|
2409
|
+
newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
|
|
2344
2410
|
|
|
2345
2411
|
// HTTP basic authentication
|
|
2346
2412
|
if (auth) {
|
|
@@ -2349,17 +2415,21 @@ const resolveConfig = (config) => {
|
|
|
2349
2415
|
);
|
|
2350
2416
|
}
|
|
2351
2417
|
|
|
2352
|
-
let contentType;
|
|
2353
|
-
|
|
2354
2418
|
if (utils$1.isFormData(data)) {
|
|
2355
2419
|
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
2356
|
-
headers.setContentType(undefined); //
|
|
2357
|
-
} else if ((
|
|
2358
|
-
//
|
|
2359
|
-
const
|
|
2360
|
-
headers
|
|
2420
|
+
headers.setContentType(undefined); // browser handles it
|
|
2421
|
+
} else if (utils$1.isFunction(data.getHeaders)) {
|
|
2422
|
+
// Node.js FormData (like form-data package)
|
|
2423
|
+
const formHeaders = data.getHeaders();
|
|
2424
|
+
// Only set safe headers to avoid overwriting security headers
|
|
2425
|
+
const allowedHeaders = ['content-type', 'content-length'];
|
|
2426
|
+
Object.entries(formHeaders).forEach(([key, val]) => {
|
|
2427
|
+
if (allowedHeaders.includes(key.toLowerCase())) {
|
|
2428
|
+
headers.set(key, val);
|
|
2429
|
+
}
|
|
2430
|
+
});
|
|
2361
2431
|
}
|
|
2362
|
-
}
|
|
2432
|
+
}
|
|
2363
2433
|
|
|
2364
2434
|
// Add xsrf header
|
|
2365
2435
|
// This is only done if running in a standard browser environment.
|
|
@@ -2476,15 +2546,18 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
2476
2546
|
};
|
|
2477
2547
|
|
|
2478
2548
|
// Handle low level network errors
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2549
|
+
request.onerror = function handleError(event) {
|
|
2550
|
+
// Browsers deliver a ProgressEvent in XHR onerror
|
|
2551
|
+
// (message may be empty; when present, surface it)
|
|
2552
|
+
// See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
|
|
2553
|
+
const msg = event && event.message ? event.message : 'Network Error';
|
|
2554
|
+
const err = new AxiosError(msg, AxiosError.ERR_NETWORK, config, request);
|
|
2555
|
+
// attach the underlying event for consumers who want details
|
|
2556
|
+
err.event = event || null;
|
|
2557
|
+
reject(err);
|
|
2558
|
+
request = null;
|
|
2486
2559
|
};
|
|
2487
|
-
|
|
2560
|
+
|
|
2488
2561
|
// Handle timeout
|
|
2489
2562
|
request.ontimeout = function handleTimeout() {
|
|
2490
2563
|
let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
|
|
@@ -2700,14 +2773,18 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
|
2700
2773
|
})
|
|
2701
2774
|
};
|
|
2702
2775
|
|
|
2703
|
-
const
|
|
2704
|
-
|
|
2776
|
+
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
2777
|
+
|
|
2778
|
+
const {isFunction} = utils$1;
|
|
2779
|
+
|
|
2780
|
+
const globalFetchAPI = (({Request, Response}) => ({
|
|
2781
|
+
Request, Response
|
|
2782
|
+
}))(utils$1.global);
|
|
2783
|
+
|
|
2784
|
+
const {
|
|
2785
|
+
ReadableStream: ReadableStream$1, TextEncoder
|
|
2786
|
+
} = utils$1.global;
|
|
2705
2787
|
|
|
2706
|
-
// used only inside the fetch adapter
|
|
2707
|
-
const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
|
|
2708
|
-
((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
|
|
2709
|
-
async (str) => new Uint8Array(await new Response(str).arrayBuffer())
|
|
2710
|
-
);
|
|
2711
2788
|
|
|
2712
2789
|
const test = (fn, ...args) => {
|
|
2713
2790
|
try {
|
|
@@ -2717,211 +2794,268 @@ const test = (fn, ...args) => {
|
|
|
2717
2794
|
}
|
|
2718
2795
|
};
|
|
2719
2796
|
|
|
2720
|
-
const
|
|
2721
|
-
|
|
2797
|
+
const factory = (env) => {
|
|
2798
|
+
env = utils$1.merge.call({
|
|
2799
|
+
skipUndefined: true
|
|
2800
|
+
}, globalFetchAPI, env);
|
|
2722
2801
|
|
|
2723
|
-
const
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
duplexAccessed = true;
|
|
2728
|
-
return 'half';
|
|
2729
|
-
},
|
|
2730
|
-
}).headers.has('Content-Type');
|
|
2802
|
+
const {fetch: envFetch, Request, Response} = env;
|
|
2803
|
+
const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
|
|
2804
|
+
const isRequestSupported = isFunction(Request);
|
|
2805
|
+
const isResponseSupported = isFunction(Response);
|
|
2731
2806
|
|
|
2732
|
-
|
|
2733
|
-
|
|
2807
|
+
if (!isFetchSupported) {
|
|
2808
|
+
return false;
|
|
2809
|
+
}
|
|
2734
2810
|
|
|
2735
|
-
const
|
|
2811
|
+
const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
|
|
2736
2812
|
|
|
2737
|
-
const
|
|
2738
|
-
|
|
2813
|
+
const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
|
|
2814
|
+
((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
|
|
2815
|
+
async (str) => new Uint8Array(await new Request(str).arrayBuffer())
|
|
2816
|
+
);
|
|
2739
2817
|
|
|
2818
|
+
const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
|
|
2819
|
+
let duplexAccessed = false;
|
|
2740
2820
|
|
|
2741
|
-
const
|
|
2742
|
-
|
|
2743
|
-
|
|
2821
|
+
const hasContentType = new Request(platform.origin, {
|
|
2822
|
+
body: new ReadableStream$1(),
|
|
2823
|
+
method: 'POST',
|
|
2824
|
+
get duplex() {
|
|
2825
|
+
duplexAccessed = true;
|
|
2826
|
+
return 'half';
|
|
2827
|
+
},
|
|
2828
|
+
}).headers.has('Content-Type');
|
|
2744
2829
|
|
|
2745
|
-
|
|
2746
|
-
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
|
|
2747
|
-
!resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
|
|
2748
|
-
(_, config) => {
|
|
2749
|
-
throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
|
|
2750
|
-
});
|
|
2830
|
+
return duplexAccessed && !hasContentType;
|
|
2751
2831
|
});
|
|
2752
|
-
})(new Response));
|
|
2753
2832
|
|
|
2754
|
-
const
|
|
2755
|
-
|
|
2756
|
-
return 0;
|
|
2757
|
-
}
|
|
2833
|
+
const supportsResponseStream = isResponseSupported && isReadableStreamSupported &&
|
|
2834
|
+
test(() => utils$1.isReadableStream(new Response('').body));
|
|
2758
2835
|
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
}
|
|
2836
|
+
const resolvers = {
|
|
2837
|
+
stream: supportsResponseStream && ((res) => res.body)
|
|
2838
|
+
};
|
|
2762
2839
|
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2840
|
+
isFetchSupported && ((() => {
|
|
2841
|
+
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
|
|
2842
|
+
!resolvers[type] && (resolvers[type] = (res, config) => {
|
|
2843
|
+
let method = res && res[type];
|
|
2844
|
+
|
|
2845
|
+
if (method) {
|
|
2846
|
+
return method.call(res);
|
|
2847
|
+
}
|
|
2848
|
+
|
|
2849
|
+
throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
|
|
2850
|
+
});
|
|
2767
2851
|
});
|
|
2768
|
-
|
|
2769
|
-
}
|
|
2852
|
+
})());
|
|
2770
2853
|
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2854
|
+
const getBodyLength = async (body) => {
|
|
2855
|
+
if (body == null) {
|
|
2856
|
+
return 0;
|
|
2857
|
+
}
|
|
2774
2858
|
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2859
|
+
if (utils$1.isBlob(body)) {
|
|
2860
|
+
return body.size;
|
|
2861
|
+
}
|
|
2778
2862
|
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2863
|
+
if (utils$1.isSpecCompliantForm(body)) {
|
|
2864
|
+
const _request = new Request(platform.origin, {
|
|
2865
|
+
method: 'POST',
|
|
2866
|
+
body,
|
|
2867
|
+
});
|
|
2868
|
+
return (await _request.arrayBuffer()).byteLength;
|
|
2869
|
+
}
|
|
2783
2870
|
|
|
2784
|
-
|
|
2785
|
-
|
|
2871
|
+
if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
|
|
2872
|
+
return body.byteLength;
|
|
2873
|
+
}
|
|
2786
2874
|
|
|
2787
|
-
|
|
2788
|
-
|
|
2875
|
+
if (utils$1.isURLSearchParams(body)) {
|
|
2876
|
+
body = body + '';
|
|
2877
|
+
}
|
|
2878
|
+
|
|
2879
|
+
if (utils$1.isString(body)) {
|
|
2880
|
+
return (await encodeText(body)).byteLength;
|
|
2881
|
+
}
|
|
2882
|
+
};
|
|
2883
|
+
|
|
2884
|
+
const resolveBodyLength = async (headers, body) => {
|
|
2885
|
+
const length = utils$1.toFiniteNumber(headers.getContentLength());
|
|
2886
|
+
|
|
2887
|
+
return length == null ? getBodyLength(body) : length;
|
|
2888
|
+
};
|
|
2889
|
+
|
|
2890
|
+
return async (config) => {
|
|
2891
|
+
let {
|
|
2892
|
+
url,
|
|
2893
|
+
method,
|
|
2894
|
+
data,
|
|
2895
|
+
signal,
|
|
2896
|
+
cancelToken,
|
|
2897
|
+
timeout,
|
|
2898
|
+
onDownloadProgress,
|
|
2899
|
+
onUploadProgress,
|
|
2900
|
+
responseType,
|
|
2901
|
+
headers,
|
|
2902
|
+
withCredentials = 'same-origin',
|
|
2903
|
+
fetchOptions
|
|
2904
|
+
} = resolveConfig(config);
|
|
2905
|
+
|
|
2906
|
+
let _fetch = envFetch || fetch;
|
|
2907
|
+
|
|
2908
|
+
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
2909
|
+
|
|
2910
|
+
let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
|
2789
2911
|
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
method,
|
|
2794
|
-
data,
|
|
2795
|
-
signal,
|
|
2796
|
-
cancelToken,
|
|
2797
|
-
timeout,
|
|
2798
|
-
onDownloadProgress,
|
|
2799
|
-
onUploadProgress,
|
|
2800
|
-
responseType,
|
|
2801
|
-
headers,
|
|
2802
|
-
withCredentials = 'same-origin',
|
|
2803
|
-
fetchOptions
|
|
2804
|
-
} = resolveConfig(config);
|
|
2805
|
-
|
|
2806
|
-
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
2807
|
-
|
|
2808
|
-
let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
|
2809
|
-
|
|
2810
|
-
let request;
|
|
2811
|
-
|
|
2812
|
-
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
|
2912
|
+
let request = null;
|
|
2913
|
+
|
|
2914
|
+
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
|
2813
2915
|
composedSignal.unsubscribe();
|
|
2814
|
-
|
|
2916
|
+
});
|
|
2815
2917
|
|
|
2816
|
-
|
|
2918
|
+
let requestContentLength;
|
|
2817
2919
|
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2920
|
+
try {
|
|
2921
|
+
if (
|
|
2922
|
+
onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
|
|
2923
|
+
(requestContentLength = await resolveBodyLength(headers, data)) !== 0
|
|
2924
|
+
) {
|
|
2925
|
+
let _request = new Request(url, {
|
|
2926
|
+
method: 'POST',
|
|
2927
|
+
body: data,
|
|
2928
|
+
duplex: "half"
|
|
2929
|
+
});
|
|
2828
2930
|
|
|
2829
|
-
|
|
2931
|
+
let contentTypeHeader;
|
|
2830
2932
|
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2933
|
+
if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
|
|
2934
|
+
headers.setContentType(contentTypeHeader);
|
|
2935
|
+
}
|
|
2834
2936
|
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2937
|
+
if (_request.body) {
|
|
2938
|
+
const [onProgress, flush] = progressEventDecorator(
|
|
2939
|
+
requestContentLength,
|
|
2940
|
+
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
2941
|
+
);
|
|
2840
2942
|
|
|
2841
|
-
|
|
2943
|
+
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
|
|
2944
|
+
}
|
|
2842
2945
|
}
|
|
2843
|
-
}
|
|
2844
2946
|
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2947
|
+
if (!utils$1.isString(withCredentials)) {
|
|
2948
|
+
withCredentials = withCredentials ? 'include' : 'omit';
|
|
2949
|
+
}
|
|
2848
2950
|
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
request = new Request(url, {
|
|
2853
|
-
...fetchOptions,
|
|
2854
|
-
signal: composedSignal,
|
|
2855
|
-
method: method.toUpperCase(),
|
|
2856
|
-
headers: headers.normalize().toJSON(),
|
|
2857
|
-
body: data,
|
|
2858
|
-
duplex: "half",
|
|
2859
|
-
credentials: isCredentialsSupported ? withCredentials : undefined
|
|
2860
|
-
});
|
|
2951
|
+
// Cloudflare Workers throws when credentials are defined
|
|
2952
|
+
// see https://github.com/cloudflare/workerd/issues/902
|
|
2953
|
+
const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
|
|
2861
2954
|
|
|
2862
|
-
|
|
2955
|
+
const resolvedOptions = {
|
|
2956
|
+
...fetchOptions,
|
|
2957
|
+
signal: composedSignal,
|
|
2958
|
+
method: method.toUpperCase(),
|
|
2959
|
+
headers: headers.normalize().toJSON(),
|
|
2960
|
+
body: data,
|
|
2961
|
+
duplex: "half",
|
|
2962
|
+
credentials: isCredentialsSupported ? withCredentials : undefined
|
|
2963
|
+
};
|
|
2863
2964
|
|
|
2864
|
-
|
|
2965
|
+
request = isRequestSupported && new Request(url, resolvedOptions);
|
|
2865
2966
|
|
|
2866
|
-
|
|
2867
|
-
const options = {};
|
|
2967
|
+
let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
|
|
2868
2968
|
|
|
2869
|
-
|
|
2870
|
-
options[prop] = response[prop];
|
|
2871
|
-
});
|
|
2969
|
+
const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
2872
2970
|
|
|
2873
|
-
|
|
2971
|
+
if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
|
|
2972
|
+
const options = {};
|
|
2874
2973
|
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
) || [];
|
|
2974
|
+
['status', 'statusText', 'headers'].forEach(prop => {
|
|
2975
|
+
options[prop] = response[prop];
|
|
2976
|
+
});
|
|
2879
2977
|
|
|
2880
|
-
|
|
2881
|
-
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
2882
|
-
flush && flush();
|
|
2883
|
-
unsubscribe && unsubscribe();
|
|
2884
|
-
}),
|
|
2885
|
-
options
|
|
2886
|
-
);
|
|
2887
|
-
}
|
|
2978
|
+
const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
|
|
2888
2979
|
|
|
2889
|
-
|
|
2980
|
+
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
|
|
2981
|
+
responseContentLength,
|
|
2982
|
+
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
2983
|
+
) || [];
|
|
2890
2984
|
|
|
2891
|
-
|
|
2985
|
+
response = new Response(
|
|
2986
|
+
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
2987
|
+
flush && flush();
|
|
2988
|
+
unsubscribe && unsubscribe();
|
|
2989
|
+
}),
|
|
2990
|
+
options
|
|
2991
|
+
);
|
|
2992
|
+
}
|
|
2892
2993
|
|
|
2893
|
-
|
|
2994
|
+
responseType = responseType || 'text';
|
|
2894
2995
|
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2996
|
+
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
|
|
2997
|
+
|
|
2998
|
+
!isStreamResponse && unsubscribe && unsubscribe();
|
|
2999
|
+
|
|
3000
|
+
return await new Promise((resolve, reject) => {
|
|
3001
|
+
settle(resolve, reject, {
|
|
3002
|
+
data: responseData,
|
|
3003
|
+
headers: AxiosHeaders$1.from(response.headers),
|
|
3004
|
+
status: response.status,
|
|
3005
|
+
statusText: response.statusText,
|
|
3006
|
+
config,
|
|
3007
|
+
request
|
|
3008
|
+
});
|
|
3009
|
+
})
|
|
3010
|
+
} catch (err) {
|
|
3011
|
+
unsubscribe && unsubscribe();
|
|
3012
|
+
|
|
3013
|
+
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
|
3014
|
+
throw Object.assign(
|
|
3015
|
+
new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
|
|
3016
|
+
{
|
|
3017
|
+
cause: err.cause || err
|
|
3018
|
+
}
|
|
3019
|
+
)
|
|
3020
|
+
}
|
|
3021
|
+
|
|
3022
|
+
throw AxiosError.from(err, err && err.code, config, request);
|
|
2915
3023
|
}
|
|
3024
|
+
}
|
|
3025
|
+
};
|
|
3026
|
+
|
|
3027
|
+
const seedCache = new Map();
|
|
3028
|
+
|
|
3029
|
+
const getFetch = (config) => {
|
|
3030
|
+
let env = config ? config.env : {};
|
|
3031
|
+
const {fetch, Request, Response} = env;
|
|
3032
|
+
const seeds = [
|
|
3033
|
+
Request, Response, fetch
|
|
3034
|
+
];
|
|
3035
|
+
|
|
3036
|
+
let len = seeds.length, i = len,
|
|
3037
|
+
seed, target, map = seedCache;
|
|
2916
3038
|
|
|
2917
|
-
|
|
3039
|
+
while (i--) {
|
|
3040
|
+
seed = seeds[i];
|
|
3041
|
+
target = map.get(seed);
|
|
3042
|
+
|
|
3043
|
+
target === undefined && map.set(seed, target = (i ? new Map() : factory(env)));
|
|
3044
|
+
|
|
3045
|
+
map = target;
|
|
2918
3046
|
}
|
|
2919
|
-
|
|
3047
|
+
|
|
3048
|
+
return target;
|
|
3049
|
+
};
|
|
3050
|
+
|
|
3051
|
+
getFetch();
|
|
2920
3052
|
|
|
2921
3053
|
const knownAdapters = {
|
|
2922
3054
|
http: httpAdapter,
|
|
2923
3055
|
xhr: xhrAdapter,
|
|
2924
|
-
fetch:
|
|
3056
|
+
fetch: {
|
|
3057
|
+
get: getFetch,
|
|
3058
|
+
}
|
|
2925
3059
|
};
|
|
2926
3060
|
|
|
2927
3061
|
utils$1.forEach(knownAdapters, (fn, value) => {
|
|
@@ -2940,7 +3074,7 @@ const renderReason = (reason) => `- ${reason}`;
|
|
|
2940
3074
|
const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
2941
3075
|
|
|
2942
3076
|
const adapters = {
|
|
2943
|
-
getAdapter: (adapters) => {
|
|
3077
|
+
getAdapter: (adapters, config) => {
|
|
2944
3078
|
adapters = utils$1.isArray(adapters) ? adapters : [adapters];
|
|
2945
3079
|
|
|
2946
3080
|
const {length} = adapters;
|
|
@@ -2963,7 +3097,7 @@ const adapters = {
|
|
|
2963
3097
|
}
|
|
2964
3098
|
}
|
|
2965
3099
|
|
|
2966
|
-
if (adapter) {
|
|
3100
|
+
if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
|
|
2967
3101
|
break;
|
|
2968
3102
|
}
|
|
2969
3103
|
|
|
@@ -3031,7 +3165,7 @@ function dispatchRequest(config) {
|
|
|
3031
3165
|
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
|
3032
3166
|
}
|
|
3033
3167
|
|
|
3034
|
-
const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
|
|
3168
|
+
const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter, config);
|
|
3035
3169
|
|
|
3036
3170
|
return adapter(config).then(function onAdapterResolution(response) {
|
|
3037
3171
|
throwIfCancellationRequested(config);
|
|
@@ -3065,7 +3199,7 @@ function dispatchRequest(config) {
|
|
|
3065
3199
|
});
|
|
3066
3200
|
}
|
|
3067
3201
|
|
|
3068
|
-
const VERSION = "1.
|
|
3202
|
+
const VERSION = "1.12.2";
|
|
3069
3203
|
|
|
3070
3204
|
const validators$1 = {};
|
|
3071
3205
|
|
|
@@ -3173,7 +3307,7 @@ const validators = validator.validators;
|
|
|
3173
3307
|
*/
|
|
3174
3308
|
class Axios {
|
|
3175
3309
|
constructor(instanceConfig) {
|
|
3176
|
-
this.defaults = instanceConfig;
|
|
3310
|
+
this.defaults = instanceConfig || {};
|
|
3177
3311
|
this.interceptors = {
|
|
3178
3312
|
request: new InterceptorManager$1(),
|
|
3179
3313
|
response: new InterceptorManager$1()
|
|
@@ -3304,8 +3438,8 @@ class Axios {
|
|
|
3304
3438
|
|
|
3305
3439
|
if (!synchronousRequestInterceptors) {
|
|
3306
3440
|
const chain = [dispatchRequest.bind(this), undefined];
|
|
3307
|
-
chain.unshift
|
|
3308
|
-
chain.push
|
|
3441
|
+
chain.unshift(...requestInterceptorChain);
|
|
3442
|
+
chain.push(...responseInterceptorChain);
|
|
3309
3443
|
len = chain.length;
|
|
3310
3444
|
|
|
3311
3445
|
promise = Promise.resolve(config);
|
|
@@ -3321,8 +3455,6 @@ class Axios {
|
|
|
3321
3455
|
|
|
3322
3456
|
let newConfig = config;
|
|
3323
3457
|
|
|
3324
|
-
i = 0;
|
|
3325
|
-
|
|
3326
3458
|
while (i < len) {
|
|
3327
3459
|
const onFulfilled = requestInterceptorChain[i++];
|
|
3328
3460
|
const onRejected = requestInterceptorChain[i++];
|
|
@@ -3706,4 +3838,4 @@ const axios$1 = axios;
|
|
|
3706
3838
|
|
|
3707
3839
|
export { axios$1 as a };
|
|
3708
3840
|
|
|
3709
|
-
//# sourceMappingURL=p-
|
|
3841
|
+
//# sourceMappingURL=p-30d100f4.js.map
|