@wiajs/req 1.7.12 → 1.7.13
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/node/req.cjs +254 -99
- package/dist/req.js +3542 -0
- package/dist/req.min.js +6 -0
- package/dist/web/req.cjs +4025 -0
- package/dist/web/req.mjs +2795 -1356
- package/lib/adapters/http.js +23 -7
- package/package.json +6 -6
- package/dist/node/req.mjs +0 -3550
package/dist/web/req.mjs
CHANGED
|
@@ -1,8 +1,1288 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @wia/req v1.7.
|
|
2
|
+
* @wia/req v1.7.13
|
|
3
3
|
* (c) 2024 Sibyl Yu, Matt Zabriskie and contributors
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
+
function bind$1(fn, thisArg) {
|
|
7
|
+
return function wrap() {
|
|
8
|
+
return fn.apply(thisArg, arguments);
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// utils is a library of generic helper functions non-specific to axios
|
|
13
|
+
|
|
14
|
+
const {toString: toString$1} = Object.prototype;
|
|
15
|
+
const {getPrototypeOf: getPrototypeOf$1} = Object;
|
|
16
|
+
|
|
17
|
+
const kindOf$1 = (cache => thing => {
|
|
18
|
+
const str = toString$1.call(thing);
|
|
19
|
+
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
|
20
|
+
})(Object.create(null));
|
|
21
|
+
|
|
22
|
+
const kindOfTest$1 = (type) => {
|
|
23
|
+
type = type.toLowerCase();
|
|
24
|
+
return (thing) => kindOf$1(thing) === type
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const typeOfTest$1 = type => thing => typeof thing === type;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Determine if a value is an Array
|
|
31
|
+
*
|
|
32
|
+
* @param {Object} val The value to test
|
|
33
|
+
*
|
|
34
|
+
* @returns {boolean} True if value is an Array, otherwise false
|
|
35
|
+
*/
|
|
36
|
+
const {isArray: isArray$1} = Array;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Determine if a value is undefined
|
|
40
|
+
*
|
|
41
|
+
* @param {*} val The value to test
|
|
42
|
+
*
|
|
43
|
+
* @returns {boolean} True if the value is undefined, otherwise false
|
|
44
|
+
*/
|
|
45
|
+
const isUndefined$1 = typeOfTest$1('undefined');
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Determine if a value is a Buffer
|
|
49
|
+
*
|
|
50
|
+
* @param {*} val The value to test
|
|
51
|
+
*
|
|
52
|
+
* @returns {boolean} True if value is a Buffer, otherwise false
|
|
53
|
+
*/
|
|
54
|
+
function isBuffer$1(val) {
|
|
55
|
+
return val !== null && !isUndefined$1(val) && val.constructor !== null && !isUndefined$1(val.constructor)
|
|
56
|
+
&& isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Determine if a value is an ArrayBuffer
|
|
61
|
+
*
|
|
62
|
+
* @param {*} val The value to test
|
|
63
|
+
*
|
|
64
|
+
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
|
65
|
+
*/
|
|
66
|
+
const isArrayBuffer$1 = kindOfTest$1('ArrayBuffer');
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Determine if a value is a view on an ArrayBuffer
|
|
71
|
+
*
|
|
72
|
+
* @param {*} val The value to test
|
|
73
|
+
*
|
|
74
|
+
* @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
|
|
75
|
+
*/
|
|
76
|
+
function isArrayBufferView$1(val) {
|
|
77
|
+
let result;
|
|
78
|
+
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
|
|
79
|
+
result = ArrayBuffer.isView(val);
|
|
80
|
+
} else {
|
|
81
|
+
result = (val) && (val.buffer) && (isArrayBuffer$1(val.buffer));
|
|
82
|
+
}
|
|
83
|
+
return result;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Determine if a value is a String
|
|
88
|
+
*
|
|
89
|
+
* @param {*} val The value to test
|
|
90
|
+
*
|
|
91
|
+
* @returns {boolean} True if value is a String, otherwise false
|
|
92
|
+
*/
|
|
93
|
+
const isString$1 = typeOfTest$1('string');
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Determine if a value is a Function
|
|
97
|
+
*
|
|
98
|
+
* @param {*} val The value to test
|
|
99
|
+
* @returns {boolean} True if value is a Function, otherwise false
|
|
100
|
+
*/
|
|
101
|
+
const isFunction$1 = typeOfTest$1('function');
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Determine if a value is a Number
|
|
105
|
+
*
|
|
106
|
+
* @param {*} val The value to test
|
|
107
|
+
*
|
|
108
|
+
* @returns {boolean} True if value is a Number, otherwise false
|
|
109
|
+
*/
|
|
110
|
+
const isNumber$1 = typeOfTest$1('number');
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Determine if a value is an Object
|
|
114
|
+
*
|
|
115
|
+
* @param {*} thing The value to test
|
|
116
|
+
*
|
|
117
|
+
* @returns {boolean} True if value is an Object, otherwise false
|
|
118
|
+
*/
|
|
119
|
+
const isObject$1 = (thing) => thing !== null && typeof thing === 'object';
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Determine if a value is a Boolean
|
|
123
|
+
*
|
|
124
|
+
* @param {*} thing The value to test
|
|
125
|
+
* @returns {boolean} True if value is a Boolean, otherwise false
|
|
126
|
+
*/
|
|
127
|
+
const isBoolean$1 = thing => thing === true || thing === false;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Determine if a value is a plain Object
|
|
131
|
+
*
|
|
132
|
+
* @param {*} val The value to test
|
|
133
|
+
*
|
|
134
|
+
* @returns {boolean} True if value is a plain Object, otherwise false
|
|
135
|
+
*/
|
|
136
|
+
const isPlainObject$1 = (val) => {
|
|
137
|
+
if (kindOf$1(val) !== 'object') {
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const prototype = getPrototypeOf$1(val);
|
|
142
|
+
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Determine if a value is a Date
|
|
147
|
+
*
|
|
148
|
+
* @param {*} val The value to test
|
|
149
|
+
*
|
|
150
|
+
* @returns {boolean} True if value is a Date, otherwise false
|
|
151
|
+
*/
|
|
152
|
+
const isDate$1 = kindOfTest$1('Date');
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Determine if a value is a File
|
|
156
|
+
*
|
|
157
|
+
* @param {*} val The value to test
|
|
158
|
+
*
|
|
159
|
+
* @returns {boolean} True if value is a File, otherwise false
|
|
160
|
+
*/
|
|
161
|
+
const isFile$1 = kindOfTest$1('File');
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Determine if a value is a Blob
|
|
165
|
+
*
|
|
166
|
+
* @param {*} val The value to test
|
|
167
|
+
*
|
|
168
|
+
* @returns {boolean} True if value is a Blob, otherwise false
|
|
169
|
+
*/
|
|
170
|
+
const isBlob$1 = kindOfTest$1('Blob');
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Determine if a value is a FileList
|
|
174
|
+
*
|
|
175
|
+
* @param {*} val The value to test
|
|
176
|
+
*
|
|
177
|
+
* @returns {boolean} True if value is a File, otherwise false
|
|
178
|
+
*/
|
|
179
|
+
const isFileList$1 = kindOfTest$1('FileList');
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Determine if a value is a Stream
|
|
183
|
+
*
|
|
184
|
+
* @param {*} val The value to test
|
|
185
|
+
*
|
|
186
|
+
* @returns {boolean} True if value is a Stream, otherwise false
|
|
187
|
+
*/
|
|
188
|
+
const isStream$1 = (val) => isObject$1(val) && isFunction$1(val.pipe);
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Determine if a value is a FormData
|
|
192
|
+
*
|
|
193
|
+
* @param {*} thing The value to test
|
|
194
|
+
*
|
|
195
|
+
* @returns {boolean} True if value is an FormData, otherwise false
|
|
196
|
+
*/
|
|
197
|
+
const isFormData$1 = (thing) => {
|
|
198
|
+
let kind;
|
|
199
|
+
return thing && (
|
|
200
|
+
(typeof FormData === 'function' && thing instanceof FormData) || (
|
|
201
|
+
isFunction$1(thing.append) && (
|
|
202
|
+
(kind = kindOf$1(thing)) === 'formdata' ||
|
|
203
|
+
// detect form-data instance
|
|
204
|
+
(kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
|
|
205
|
+
)
|
|
206
|
+
)
|
|
207
|
+
)
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Determine if a value is a URLSearchParams object
|
|
212
|
+
*
|
|
213
|
+
* @param {*} val The value to test
|
|
214
|
+
*
|
|
215
|
+
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
|
216
|
+
*/
|
|
217
|
+
const isURLSearchParams$1 = kindOfTest$1('URLSearchParams');
|
|
218
|
+
|
|
219
|
+
const [isReadableStream$1, isRequest$1, isResponse$1, isHeaders$1] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest$1);
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Trim excess whitespace off the beginning and end of a string
|
|
223
|
+
*
|
|
224
|
+
* @param {String} str The String to trim
|
|
225
|
+
*
|
|
226
|
+
* @returns {String} The String freed of excess whitespace
|
|
227
|
+
*/
|
|
228
|
+
const trim$1 = (str) => str.trim ?
|
|
229
|
+
str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Iterate over an Array or an Object invoking a function for each item.
|
|
233
|
+
*
|
|
234
|
+
* If `obj` is an Array callback will be called passing
|
|
235
|
+
* the value, index, and complete array for each item.
|
|
236
|
+
*
|
|
237
|
+
* If 'obj' is an Object callback will be called passing
|
|
238
|
+
* the value, key, and complete object for each property.
|
|
239
|
+
*
|
|
240
|
+
* @param {Object|Array} obj The object to iterate
|
|
241
|
+
* @param {Function} fn The callback to invoke for each item
|
|
242
|
+
*
|
|
243
|
+
* @param {Boolean} [allOwnKeys = false]
|
|
244
|
+
* @returns {any}
|
|
245
|
+
*/
|
|
246
|
+
function forEach$1(obj, fn, {allOwnKeys = false} = {}) {
|
|
247
|
+
// Don't bother if no value provided
|
|
248
|
+
if (obj === null || typeof obj === 'undefined') {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
let i;
|
|
253
|
+
let l;
|
|
254
|
+
|
|
255
|
+
// Force an array if not already something iterable
|
|
256
|
+
if (typeof obj !== 'object') {
|
|
257
|
+
/*eslint no-param-reassign:0*/
|
|
258
|
+
obj = [obj];
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
if (isArray$1(obj)) {
|
|
262
|
+
// Iterate over array values
|
|
263
|
+
for (i = 0, l = obj.length; i < l; i++) {
|
|
264
|
+
fn.call(null, obj[i], i, obj);
|
|
265
|
+
}
|
|
266
|
+
} else {
|
|
267
|
+
// Iterate over object keys
|
|
268
|
+
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
269
|
+
const len = keys.length;
|
|
270
|
+
let key;
|
|
271
|
+
|
|
272
|
+
for (i = 0; i < len; i++) {
|
|
273
|
+
key = keys[i];
|
|
274
|
+
fn.call(null, obj[key], key, obj);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
function findKey$1(obj, key) {
|
|
280
|
+
key = key.toLowerCase();
|
|
281
|
+
const keys = Object.keys(obj);
|
|
282
|
+
let i = keys.length;
|
|
283
|
+
let _key;
|
|
284
|
+
while (i-- > 0) {
|
|
285
|
+
_key = keys[i];
|
|
286
|
+
if (key === _key.toLowerCase()) {
|
|
287
|
+
return _key;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return null;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
const _global$1 = (() => {
|
|
294
|
+
/*eslint no-undef:0*/
|
|
295
|
+
if (typeof globalThis !== "undefined") return globalThis;
|
|
296
|
+
return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global)
|
|
297
|
+
})();
|
|
298
|
+
|
|
299
|
+
const isContextDefined$1 = (context) => !isUndefined$1(context) && context !== _global$1;
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Accepts varargs expecting each argument to be an object, then
|
|
303
|
+
* immutably merges the properties of each object and returns result.
|
|
304
|
+
*
|
|
305
|
+
* When multiple objects contain the same key the later object in
|
|
306
|
+
* the arguments list will take precedence.
|
|
307
|
+
*
|
|
308
|
+
* Example:
|
|
309
|
+
*
|
|
310
|
+
* ```js
|
|
311
|
+
* var result = merge({foo: 123}, {foo: 456});
|
|
312
|
+
* console.log(result.foo); // outputs 456
|
|
313
|
+
* ```
|
|
314
|
+
*
|
|
315
|
+
* @param {Object} obj1 Object to merge
|
|
316
|
+
*
|
|
317
|
+
* @returns {Object} Result of all merge properties
|
|
318
|
+
*/
|
|
319
|
+
function merge$1(/* obj1, obj2, obj3, ... */) {
|
|
320
|
+
const {caseless} = isContextDefined$1(this) && this || {};
|
|
321
|
+
const result = {};
|
|
322
|
+
const assignValue = (val, key) => {
|
|
323
|
+
const targetKey = caseless && findKey$1(result, key) || key;
|
|
324
|
+
if (isPlainObject$1(result[targetKey]) && isPlainObject$1(val)) {
|
|
325
|
+
result[targetKey] = merge$1(result[targetKey], val);
|
|
326
|
+
} else if (isPlainObject$1(val)) {
|
|
327
|
+
result[targetKey] = merge$1({}, val);
|
|
328
|
+
} else if (isArray$1(val)) {
|
|
329
|
+
result[targetKey] = val.slice();
|
|
330
|
+
} else {
|
|
331
|
+
result[targetKey] = val;
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
for (let i = 0, l = arguments.length; i < l; i++) {
|
|
336
|
+
arguments[i] && forEach$1(arguments[i], assignValue);
|
|
337
|
+
}
|
|
338
|
+
return result;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Extends object a by mutably adding to it the properties of object b.
|
|
343
|
+
*
|
|
344
|
+
* @param {Object} a The object to be extended
|
|
345
|
+
* @param {Object} b The object to copy properties from
|
|
346
|
+
* @param {Object} thisArg The object to bind function to
|
|
347
|
+
*
|
|
348
|
+
* @param {Boolean} [allOwnKeys]
|
|
349
|
+
* @returns {Object} The resulting value of object a
|
|
350
|
+
*/
|
|
351
|
+
const extend$1 = (a, b, thisArg, {allOwnKeys} = {}) => {
|
|
352
|
+
forEach$1(b, (val, key) => {
|
|
353
|
+
if (thisArg && isFunction$1(val)) {
|
|
354
|
+
a[key] = bind$1(val, thisArg);
|
|
355
|
+
} else {
|
|
356
|
+
a[key] = val;
|
|
357
|
+
}
|
|
358
|
+
}, {allOwnKeys});
|
|
359
|
+
return a;
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
|
|
364
|
+
*
|
|
365
|
+
* @param {string} content with BOM
|
|
366
|
+
*
|
|
367
|
+
* @returns {string} content value without BOM
|
|
368
|
+
*/
|
|
369
|
+
const stripBOM$1 = (content) => {
|
|
370
|
+
if (content.charCodeAt(0) === 0xFEFF) {
|
|
371
|
+
content = content.slice(1);
|
|
372
|
+
}
|
|
373
|
+
return content;
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Inherit the prototype methods from one constructor into another
|
|
378
|
+
* @param {function} constructor
|
|
379
|
+
* @param {function} superConstructor
|
|
380
|
+
* @param {object} [props]
|
|
381
|
+
* @param {object} [descriptors]
|
|
382
|
+
*
|
|
383
|
+
* @returns {void}
|
|
384
|
+
*/
|
|
385
|
+
const inherits$1 = (constructor, superConstructor, props, descriptors) => {
|
|
386
|
+
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
|
387
|
+
constructor.prototype.constructor = constructor;
|
|
388
|
+
Object.defineProperty(constructor, 'super', {
|
|
389
|
+
value: superConstructor.prototype
|
|
390
|
+
});
|
|
391
|
+
props && Object.assign(constructor.prototype, props);
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Resolve object with deep prototype chain to a flat object
|
|
396
|
+
* @param {Object} sourceObj source object
|
|
397
|
+
* @param {Object} [destObj]
|
|
398
|
+
* @param {Function|Boolean} [filter]
|
|
399
|
+
* @param {Function} [propFilter]
|
|
400
|
+
*
|
|
401
|
+
* @returns {Object}
|
|
402
|
+
*/
|
|
403
|
+
const toFlatObject$1 = (sourceObj, destObj, filter, propFilter) => {
|
|
404
|
+
let props;
|
|
405
|
+
let i;
|
|
406
|
+
let prop;
|
|
407
|
+
const merged = {};
|
|
408
|
+
|
|
409
|
+
destObj = destObj || {};
|
|
410
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
411
|
+
if (sourceObj == null) return destObj;
|
|
412
|
+
|
|
413
|
+
do {
|
|
414
|
+
props = Object.getOwnPropertyNames(sourceObj);
|
|
415
|
+
i = props.length;
|
|
416
|
+
while (i-- > 0) {
|
|
417
|
+
prop = props[i];
|
|
418
|
+
if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
|
|
419
|
+
destObj[prop] = sourceObj[prop];
|
|
420
|
+
merged[prop] = true;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
sourceObj = filter !== false && getPrototypeOf$1(sourceObj);
|
|
424
|
+
} while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
|
425
|
+
|
|
426
|
+
return destObj;
|
|
427
|
+
};
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* Determines whether a string ends with the characters of a specified string
|
|
431
|
+
*
|
|
432
|
+
* @param {String} str
|
|
433
|
+
* @param {String} searchString
|
|
434
|
+
* @param {Number} [position= 0]
|
|
435
|
+
*
|
|
436
|
+
* @returns {boolean}
|
|
437
|
+
*/
|
|
438
|
+
const endsWith$1 = (str, searchString, position) => {
|
|
439
|
+
str = String(str);
|
|
440
|
+
if (position === undefined || position > str.length) {
|
|
441
|
+
position = str.length;
|
|
442
|
+
}
|
|
443
|
+
position -= searchString.length;
|
|
444
|
+
const lastIndex = str.indexOf(searchString, position);
|
|
445
|
+
return lastIndex !== -1 && lastIndex === position;
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* Returns new array from array like object or null if failed
|
|
451
|
+
*
|
|
452
|
+
* @param {*} [thing]
|
|
453
|
+
*
|
|
454
|
+
* @returns {?Array}
|
|
455
|
+
*/
|
|
456
|
+
const toArray$1 = (thing) => {
|
|
457
|
+
if (!thing) return null;
|
|
458
|
+
if (isArray$1(thing)) return thing;
|
|
459
|
+
let i = thing.length;
|
|
460
|
+
if (!isNumber$1(i)) return null;
|
|
461
|
+
const arr = new Array(i);
|
|
462
|
+
while (i-- > 0) {
|
|
463
|
+
arr[i] = thing[i];
|
|
464
|
+
}
|
|
465
|
+
return arr;
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Checking if the Uint8Array exists and if it does, it returns a function that checks if the
|
|
470
|
+
* thing passed in is an instance of Uint8Array
|
|
471
|
+
*
|
|
472
|
+
* @param {TypedArray}
|
|
473
|
+
*
|
|
474
|
+
* @returns {Array}
|
|
475
|
+
*/
|
|
476
|
+
// eslint-disable-next-line func-names
|
|
477
|
+
const isTypedArray$1 = (TypedArray => {
|
|
478
|
+
// eslint-disable-next-line func-names
|
|
479
|
+
return thing => {
|
|
480
|
+
return TypedArray && thing instanceof TypedArray;
|
|
481
|
+
};
|
|
482
|
+
})(typeof Uint8Array !== 'undefined' && getPrototypeOf$1(Uint8Array));
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* For each entry in the object, call the function with the key and value.
|
|
486
|
+
*
|
|
487
|
+
* @param {Object<any, any>} obj - The object to iterate over.
|
|
488
|
+
* @param {Function} fn - The function to call for each entry.
|
|
489
|
+
*
|
|
490
|
+
* @returns {void}
|
|
491
|
+
*/
|
|
492
|
+
const forEachEntry$1 = (obj, fn) => {
|
|
493
|
+
const generator = obj && obj[Symbol.iterator];
|
|
494
|
+
|
|
495
|
+
const iterator = generator.call(obj);
|
|
496
|
+
|
|
497
|
+
let result;
|
|
498
|
+
|
|
499
|
+
while ((result = iterator.next()) && !result.done) {
|
|
500
|
+
const pair = result.value;
|
|
501
|
+
fn.call(obj, pair[0], pair[1]);
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* It takes a regular expression and a string, and returns an array of all the matches
|
|
507
|
+
*
|
|
508
|
+
* @param {string} regExp - The regular expression to match against.
|
|
509
|
+
* @param {string} str - The string to search.
|
|
510
|
+
*
|
|
511
|
+
* @returns {Array<boolean>}
|
|
512
|
+
*/
|
|
513
|
+
const matchAll$1 = (regExp, str) => {
|
|
514
|
+
let matches;
|
|
515
|
+
const arr = [];
|
|
516
|
+
|
|
517
|
+
while ((matches = regExp.exec(str)) !== null) {
|
|
518
|
+
arr.push(matches);
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
return arr;
|
|
522
|
+
};
|
|
523
|
+
|
|
524
|
+
/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
|
|
525
|
+
const isHTMLForm$1 = kindOfTest$1('HTMLFormElement');
|
|
526
|
+
|
|
527
|
+
const toCamelCase$1 = str => {
|
|
528
|
+
return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,
|
|
529
|
+
function replacer(m, p1, p2) {
|
|
530
|
+
return p1.toUpperCase() + p2;
|
|
531
|
+
}
|
|
532
|
+
);
|
|
533
|
+
};
|
|
534
|
+
|
|
535
|
+
/* Creating a function that will check if an object has a property. */
|
|
536
|
+
const hasOwnProperty$1 = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* Determine if a value is a RegExp object
|
|
540
|
+
*
|
|
541
|
+
* @param {*} val The value to test
|
|
542
|
+
*
|
|
543
|
+
* @returns {boolean} True if value is a RegExp object, otherwise false
|
|
544
|
+
*/
|
|
545
|
+
const isRegExp$1 = kindOfTest$1('RegExp');
|
|
546
|
+
|
|
547
|
+
const reduceDescriptors$1 = (obj, reducer) => {
|
|
548
|
+
const descriptors = Object.getOwnPropertyDescriptors(obj);
|
|
549
|
+
const reducedDescriptors = {};
|
|
550
|
+
|
|
551
|
+
forEach$1(descriptors, (descriptor, name) => {
|
|
552
|
+
let ret;
|
|
553
|
+
if ((ret = reducer(descriptor, name, obj)) !== false) {
|
|
554
|
+
reducedDescriptors[name] = ret || descriptor;
|
|
555
|
+
}
|
|
556
|
+
});
|
|
557
|
+
|
|
558
|
+
Object.defineProperties(obj, reducedDescriptors);
|
|
559
|
+
};
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* Makes all methods read-only
|
|
563
|
+
* @param {Object} obj
|
|
564
|
+
*/
|
|
565
|
+
|
|
566
|
+
const freezeMethods$1 = (obj) => {
|
|
567
|
+
reduceDescriptors$1(obj, (descriptor, name) => {
|
|
568
|
+
// skip restricted props in strict mode
|
|
569
|
+
if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
|
570
|
+
return false;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
const value = obj[name];
|
|
574
|
+
|
|
575
|
+
if (!isFunction$1(value)) return;
|
|
576
|
+
|
|
577
|
+
descriptor.enumerable = false;
|
|
578
|
+
|
|
579
|
+
if ('writable' in descriptor) {
|
|
580
|
+
descriptor.writable = false;
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
if (!descriptor.set) {
|
|
585
|
+
descriptor.set = () => {
|
|
586
|
+
throw Error('Can not rewrite read-only method \'' + name + '\'');
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
});
|
|
590
|
+
};
|
|
591
|
+
|
|
592
|
+
const toObjectSet$1 = (arrayOrString, delimiter) => {
|
|
593
|
+
const obj = {};
|
|
594
|
+
|
|
595
|
+
const define = (arr) => {
|
|
596
|
+
arr.forEach(value => {
|
|
597
|
+
obj[value] = true;
|
|
598
|
+
});
|
|
599
|
+
};
|
|
600
|
+
|
|
601
|
+
isArray$1(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
|
|
602
|
+
|
|
603
|
+
return obj;
|
|
604
|
+
};
|
|
605
|
+
|
|
606
|
+
const noop$1 = () => {};
|
|
607
|
+
|
|
608
|
+
const toFiniteNumber$1 = (value, defaultValue) => {
|
|
609
|
+
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
|
|
610
|
+
};
|
|
611
|
+
|
|
612
|
+
const ALPHA$1 = 'abcdefghijklmnopqrstuvwxyz';
|
|
613
|
+
|
|
614
|
+
const DIGIT$1 = '0123456789';
|
|
615
|
+
|
|
616
|
+
const ALPHABET$1 = {
|
|
617
|
+
DIGIT: DIGIT$1,
|
|
618
|
+
ALPHA: ALPHA$1,
|
|
619
|
+
ALPHA_DIGIT: ALPHA$1 + ALPHA$1.toUpperCase() + DIGIT$1
|
|
620
|
+
};
|
|
621
|
+
|
|
622
|
+
const generateString$1 = (size = 16, alphabet = ALPHABET$1.ALPHA_DIGIT) => {
|
|
623
|
+
let str = '';
|
|
624
|
+
const {length} = alphabet;
|
|
625
|
+
while (size--) {
|
|
626
|
+
str += alphabet[Math.random() * length|0];
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
return str;
|
|
630
|
+
};
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* If the thing is a FormData object, return true, otherwise return false.
|
|
634
|
+
*
|
|
635
|
+
* @param {unknown} thing - The thing to check.
|
|
636
|
+
*
|
|
637
|
+
* @returns {boolean}
|
|
638
|
+
*/
|
|
639
|
+
function isSpecCompliantForm$1(thing) {
|
|
640
|
+
return !!(thing && isFunction$1(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
const toJSONObject$1 = (obj) => {
|
|
644
|
+
const stack = new Array(10);
|
|
645
|
+
|
|
646
|
+
const visit = (source, i) => {
|
|
647
|
+
|
|
648
|
+
if (isObject$1(source)) {
|
|
649
|
+
if (stack.indexOf(source) >= 0) {
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
if (!('toJSON' in source)) {
|
|
654
|
+
stack[i] = source;
|
|
655
|
+
const target = isArray$1(source) ? [] : {};
|
|
656
|
+
|
|
657
|
+
forEach$1(source, (value, key) => {
|
|
658
|
+
const reducedValue = visit(value, i + 1);
|
|
659
|
+
!isUndefined$1(reducedValue) && (target[key] = reducedValue);
|
|
660
|
+
});
|
|
661
|
+
|
|
662
|
+
stack[i] = undefined;
|
|
663
|
+
|
|
664
|
+
return target;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
return source;
|
|
669
|
+
};
|
|
670
|
+
|
|
671
|
+
return visit(obj, 0);
|
|
672
|
+
};
|
|
673
|
+
|
|
674
|
+
const isAsyncFn$1 = kindOfTest$1('AsyncFunction');
|
|
675
|
+
|
|
676
|
+
const isThenable$1 = (thing) =>
|
|
677
|
+
thing && (isObject$1(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
|
|
678
|
+
|
|
679
|
+
// original code
|
|
680
|
+
// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
|
|
681
|
+
|
|
682
|
+
const _setImmediate$1 = ((setImmediateSupported, postMessageSupported) => {
|
|
683
|
+
if (setImmediateSupported) {
|
|
684
|
+
return setImmediate;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
return postMessageSupported ? ((token, callbacks) => {
|
|
688
|
+
_global$1.addEventListener("message", ({source, data}) => {
|
|
689
|
+
if (source === _global$1 && data === token) {
|
|
690
|
+
callbacks.length && callbacks.shift()();
|
|
691
|
+
}
|
|
692
|
+
}, false);
|
|
693
|
+
|
|
694
|
+
return (cb) => {
|
|
695
|
+
callbacks.push(cb);
|
|
696
|
+
_global$1.postMessage(token, "*");
|
|
697
|
+
}
|
|
698
|
+
})(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
|
|
699
|
+
})(
|
|
700
|
+
typeof setImmediate === 'function',
|
|
701
|
+
isFunction$1(_global$1.postMessage)
|
|
702
|
+
);
|
|
703
|
+
|
|
704
|
+
const asap$1 = typeof queueMicrotask !== 'undefined' ?
|
|
705
|
+
queueMicrotask.bind(_global$1) : ( typeof process !== 'undefined' && process.nextTick || _setImmediate$1);
|
|
706
|
+
|
|
707
|
+
|
|
708
|
+
function createErrorType$1(code, message, baseClass) {
|
|
709
|
+
// Create constructor
|
|
710
|
+
function CustomError(properties) {
|
|
711
|
+
Error.captureStackTrace(this, this.constructor);
|
|
712
|
+
Object.assign(this, properties || {});
|
|
713
|
+
this.code = code;
|
|
714
|
+
this.message = this.cause ? `${message}: ${this.cause.message}` : message;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
// Attach constructor and set default properties
|
|
718
|
+
CustomError.prototype = new (baseClass || Error)();
|
|
719
|
+
CustomError.prototype.constructor = CustomError;
|
|
720
|
+
CustomError.prototype.name = `Error [${code}]`;
|
|
721
|
+
return CustomError;
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
|
|
725
|
+
// *********************
|
|
726
|
+
|
|
727
|
+
const utils$2 = {
|
|
728
|
+
isArray: isArray$1,
|
|
729
|
+
isArrayBuffer: isArrayBuffer$1,
|
|
730
|
+
isBuffer: isBuffer$1,
|
|
731
|
+
isFormData: isFormData$1,
|
|
732
|
+
isArrayBufferView: isArrayBufferView$1,
|
|
733
|
+
isString: isString$1,
|
|
734
|
+
isNumber: isNumber$1,
|
|
735
|
+
isBoolean: isBoolean$1,
|
|
736
|
+
isObject: isObject$1,
|
|
737
|
+
isPlainObject: isPlainObject$1,
|
|
738
|
+
isReadableStream: isReadableStream$1,
|
|
739
|
+
isRequest: isRequest$1,
|
|
740
|
+
isResponse: isResponse$1,
|
|
741
|
+
isHeaders: isHeaders$1,
|
|
742
|
+
isUndefined: isUndefined$1,
|
|
743
|
+
isDate: isDate$1,
|
|
744
|
+
isFile: isFile$1,
|
|
745
|
+
isBlob: isBlob$1,
|
|
746
|
+
isRegExp: isRegExp$1,
|
|
747
|
+
isFunction: isFunction$1,
|
|
748
|
+
isStream: isStream$1,
|
|
749
|
+
isURLSearchParams: isURLSearchParams$1,
|
|
750
|
+
isTypedArray: isTypedArray$1,
|
|
751
|
+
isFileList: isFileList$1,
|
|
752
|
+
forEach: forEach$1,
|
|
753
|
+
merge: merge$1,
|
|
754
|
+
extend: extend$1,
|
|
755
|
+
trim: trim$1,
|
|
756
|
+
stripBOM: stripBOM$1,
|
|
757
|
+
inherits: inherits$1,
|
|
758
|
+
toFlatObject: toFlatObject$1,
|
|
759
|
+
kindOf: kindOf$1,
|
|
760
|
+
kindOfTest: kindOfTest$1,
|
|
761
|
+
endsWith: endsWith$1,
|
|
762
|
+
toArray: toArray$1,
|
|
763
|
+
forEachEntry: forEachEntry$1,
|
|
764
|
+
matchAll: matchAll$1,
|
|
765
|
+
isHTMLForm: isHTMLForm$1,
|
|
766
|
+
hasOwnProperty: hasOwnProperty$1,
|
|
767
|
+
hasOwnProp: hasOwnProperty$1, // an alias to avoid ESLint no-prototype-builtins detection
|
|
768
|
+
reduceDescriptors: reduceDescriptors$1,
|
|
769
|
+
freezeMethods: freezeMethods$1,
|
|
770
|
+
toObjectSet: toObjectSet$1,
|
|
771
|
+
toCamelCase: toCamelCase$1,
|
|
772
|
+
noop: noop$1,
|
|
773
|
+
toFiniteNumber: toFiniteNumber$1,
|
|
774
|
+
findKey: findKey$1,
|
|
775
|
+
global: _global$1,
|
|
776
|
+
isContextDefined: isContextDefined$1,
|
|
777
|
+
ALPHABET: ALPHABET$1,
|
|
778
|
+
generateString: generateString$1,
|
|
779
|
+
isSpecCompliantForm: isSpecCompliantForm$1,
|
|
780
|
+
toJSONObject: toJSONObject$1,
|
|
781
|
+
isAsyncFn: isAsyncFn$1,
|
|
782
|
+
isThenable: isThenable$1,
|
|
783
|
+
setImmediate: _setImmediate$1,
|
|
784
|
+
asap: asap$1,
|
|
785
|
+
createErrorType: createErrorType$1
|
|
786
|
+
};
|
|
787
|
+
|
|
788
|
+
/**
|
|
789
|
+
* Create an Error with the specified message, config, error code, request and response.
|
|
790
|
+
*
|
|
791
|
+
* @param {string} message The error message.
|
|
792
|
+
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
793
|
+
* @param {Object} [config] The config.
|
|
794
|
+
* @param {Object} [request] The request.
|
|
795
|
+
* @param {Object} [response] The response.
|
|
796
|
+
*
|
|
797
|
+
* @returns {Error} The created error.
|
|
798
|
+
*/
|
|
799
|
+
function AxiosError$2(message, code, config, request, response) {
|
|
800
|
+
Error.call(this);
|
|
801
|
+
|
|
802
|
+
if (Error.captureStackTrace) {
|
|
803
|
+
Error.captureStackTrace(this, this.constructor);
|
|
804
|
+
} else {
|
|
805
|
+
this.stack = (new Error()).stack;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
this.message = message;
|
|
809
|
+
this.name = 'AxiosError';
|
|
810
|
+
code && (this.code = code);
|
|
811
|
+
config && (this.config = config);
|
|
812
|
+
request && (this.request = request);
|
|
813
|
+
if (response) {
|
|
814
|
+
this.response = response;
|
|
815
|
+
this.status = response.status ? response.status : null;
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
utils$2.inherits(AxiosError$2, Error, {
|
|
820
|
+
toJSON: function toJSON() {
|
|
821
|
+
return {
|
|
822
|
+
// Standard
|
|
823
|
+
message: this.message,
|
|
824
|
+
name: this.name,
|
|
825
|
+
// Microsoft
|
|
826
|
+
description: this.description,
|
|
827
|
+
number: this.number,
|
|
828
|
+
// Mozilla
|
|
829
|
+
fileName: this.fileName,
|
|
830
|
+
lineNumber: this.lineNumber,
|
|
831
|
+
columnNumber: this.columnNumber,
|
|
832
|
+
stack: this.stack,
|
|
833
|
+
// Axios
|
|
834
|
+
config: utils$2.toJSONObject(this.config),
|
|
835
|
+
code: this.code,
|
|
836
|
+
status: this.status
|
|
837
|
+
};
|
|
838
|
+
}
|
|
839
|
+
});
|
|
840
|
+
|
|
841
|
+
const prototype$3 = AxiosError$2.prototype;
|
|
842
|
+
const descriptors$1 = {};
|
|
843
|
+
|
|
844
|
+
[
|
|
845
|
+
'ERR_BAD_OPTION_VALUE',
|
|
846
|
+
'ERR_BAD_OPTION',
|
|
847
|
+
'ECONNABORTED',
|
|
848
|
+
'ETIMEDOUT',
|
|
849
|
+
'ERR_NETWORK',
|
|
850
|
+
'ERR_FR_TOO_MANY_REDIRECTS',
|
|
851
|
+
'ERR_DEPRECATED',
|
|
852
|
+
'ERR_BAD_RESPONSE',
|
|
853
|
+
'ERR_BAD_REQUEST',
|
|
854
|
+
'ERR_CANCELED',
|
|
855
|
+
'ERR_NOT_SUPPORT',
|
|
856
|
+
'ERR_INVALID_URL'
|
|
857
|
+
// eslint-disable-next-line func-names
|
|
858
|
+
].forEach(code => {
|
|
859
|
+
descriptors$1[code] = {value: code};
|
|
860
|
+
});
|
|
861
|
+
|
|
862
|
+
Object.defineProperties(AxiosError$2, descriptors$1);
|
|
863
|
+
Object.defineProperty(prototype$3, 'isAxiosError', {value: true});
|
|
864
|
+
|
|
865
|
+
// eslint-disable-next-line func-names
|
|
866
|
+
AxiosError$2.from = (error, code, config, request, response, customProps) => {
|
|
867
|
+
const axiosError = Object.create(prototype$3);
|
|
868
|
+
|
|
869
|
+
utils$2.toFlatObject(error, axiosError, function filter(obj) {
|
|
870
|
+
return obj !== Error.prototype;
|
|
871
|
+
}, prop => {
|
|
872
|
+
return prop !== 'isAxiosError';
|
|
873
|
+
});
|
|
874
|
+
|
|
875
|
+
AxiosError$2.call(axiosError, error.message, code, config, request, response);
|
|
876
|
+
|
|
877
|
+
axiosError.cause = error;
|
|
878
|
+
|
|
879
|
+
axiosError.name = error.name;
|
|
880
|
+
|
|
881
|
+
customProps && Object.assign(axiosError, customProps);
|
|
882
|
+
|
|
883
|
+
return axiosError;
|
|
884
|
+
};
|
|
885
|
+
|
|
886
|
+
// eslint-disable-next-line strict
|
|
887
|
+
const HttpAdapter = null;
|
|
888
|
+
|
|
889
|
+
/**
|
|
890
|
+
* Determines if the given thing is a array or js object.
|
|
891
|
+
*
|
|
892
|
+
* @param {string} thing - The object or array to be visited.
|
|
893
|
+
*
|
|
894
|
+
* @returns {boolean}
|
|
895
|
+
*/
|
|
896
|
+
function isVisitable$1(thing) {
|
|
897
|
+
return utils$2.isPlainObject(thing) || utils$2.isArray(thing);
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
/**
|
|
901
|
+
* It removes the brackets from the end of a string
|
|
902
|
+
*
|
|
903
|
+
* @param {string} key - The key of the parameter.
|
|
904
|
+
*
|
|
905
|
+
* @returns {string} the key without the brackets.
|
|
906
|
+
*/
|
|
907
|
+
function removeBrackets$1(key) {
|
|
908
|
+
return utils$2.endsWith(key, '[]') ? key.slice(0, -2) : key;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
/**
|
|
912
|
+
* It takes a path, a key, and a boolean, and returns a string
|
|
913
|
+
*
|
|
914
|
+
* @param {string} path - The path to the current key.
|
|
915
|
+
* @param {string} key - The key of the current object being iterated over.
|
|
916
|
+
* @param {string} dots - If true, the key will be rendered with dots instead of brackets.
|
|
917
|
+
*
|
|
918
|
+
* @returns {string} The path to the current key.
|
|
919
|
+
*/
|
|
920
|
+
function renderKey$1(path, key, dots) {
|
|
921
|
+
if (!path) return key;
|
|
922
|
+
return path.concat(key).map(function each(token, i) {
|
|
923
|
+
// eslint-disable-next-line no-param-reassign
|
|
924
|
+
token = removeBrackets$1(token);
|
|
925
|
+
return !dots && i ? '[' + token + ']' : token;
|
|
926
|
+
}).join(dots ? '.' : '');
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
/**
|
|
930
|
+
* If the array is an array and none of its elements are visitable, then it's a flat array.
|
|
931
|
+
*
|
|
932
|
+
* @param {Array<any>} arr - The array to check
|
|
933
|
+
*
|
|
934
|
+
* @returns {boolean}
|
|
935
|
+
*/
|
|
936
|
+
function isFlatArray$1(arr) {
|
|
937
|
+
return utils$2.isArray(arr) && !arr.some(isVisitable$1);
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
const predicates$1 = utils$2.toFlatObject(utils$2, {}, null, function filter(prop) {
|
|
941
|
+
return /^is[A-Z]/.test(prop);
|
|
942
|
+
});
|
|
943
|
+
|
|
944
|
+
/**
|
|
945
|
+
* Convert a data object to FormData
|
|
946
|
+
*
|
|
947
|
+
* @param {Object} obj
|
|
948
|
+
* @param {?Object} [formData]
|
|
949
|
+
* @param {?Object} [options]
|
|
950
|
+
* @param {Function} [options.visitor]
|
|
951
|
+
* @param {Boolean} [options.metaTokens = true]
|
|
952
|
+
* @param {Boolean} [options.dots = false]
|
|
953
|
+
* @param {?Boolean} [options.indexes = false]
|
|
954
|
+
*
|
|
955
|
+
* @returns {Object}
|
|
956
|
+
**/
|
|
957
|
+
|
|
958
|
+
/**
|
|
959
|
+
* It converts an object into a FormData object
|
|
960
|
+
*
|
|
961
|
+
* @param {Object<any, any>} obj - The object to convert to form data.
|
|
962
|
+
* @param {string} formData - The FormData object to append to.
|
|
963
|
+
* @param {Object<string, any>} options
|
|
964
|
+
*
|
|
965
|
+
* @returns
|
|
966
|
+
*/
|
|
967
|
+
function toFormData$2(obj, formData, options) {
|
|
968
|
+
if (!utils$2.isObject(obj)) {
|
|
969
|
+
throw new TypeError('target must be an object');
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
// eslint-disable-next-line no-param-reassign
|
|
973
|
+
formData = formData || new (FormData)();
|
|
974
|
+
|
|
975
|
+
// eslint-disable-next-line no-param-reassign
|
|
976
|
+
options = utils$2.toFlatObject(options, {
|
|
977
|
+
metaTokens: true,
|
|
978
|
+
dots: false,
|
|
979
|
+
indexes: false
|
|
980
|
+
}, false, function defined(option, source) {
|
|
981
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
982
|
+
return !utils$2.isUndefined(source[option]);
|
|
983
|
+
});
|
|
984
|
+
|
|
985
|
+
const metaTokens = options.metaTokens;
|
|
986
|
+
// eslint-disable-next-line no-use-before-define
|
|
987
|
+
const visitor = options.visitor || defaultVisitor;
|
|
988
|
+
const dots = options.dots;
|
|
989
|
+
const indexes = options.indexes;
|
|
990
|
+
const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
|
|
991
|
+
const useBlob = _Blob && utils$2.isSpecCompliantForm(formData);
|
|
992
|
+
|
|
993
|
+
if (!utils$2.isFunction(visitor)) {
|
|
994
|
+
throw new TypeError('visitor must be a function');
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
function convertValue(value) {
|
|
998
|
+
if (value === null) return '';
|
|
999
|
+
|
|
1000
|
+
if (utils$2.isDate(value)) {
|
|
1001
|
+
return value.toISOString();
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
if (!useBlob && utils$2.isBlob(value)) {
|
|
1005
|
+
throw new AxiosError$2('Blob is not supported. Use a Buffer instead.');
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
if (utils$2.isArrayBuffer(value) || utils$2.isTypedArray(value)) {
|
|
1009
|
+
return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
return value;
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
/**
|
|
1016
|
+
* Default visitor.
|
|
1017
|
+
*
|
|
1018
|
+
* @param {*} value
|
|
1019
|
+
* @param {String|Number} key
|
|
1020
|
+
* @param {Array<String|Number>} path
|
|
1021
|
+
* @this {FormData}
|
|
1022
|
+
*
|
|
1023
|
+
* @returns {boolean} return true to visit the each prop of the value recursively
|
|
1024
|
+
*/
|
|
1025
|
+
function defaultVisitor(value, key, path) {
|
|
1026
|
+
let arr = value;
|
|
1027
|
+
|
|
1028
|
+
if (value && !path && typeof value === 'object') {
|
|
1029
|
+
if (utils$2.endsWith(key, '{}')) {
|
|
1030
|
+
// eslint-disable-next-line no-param-reassign
|
|
1031
|
+
key = metaTokens ? key : key.slice(0, -2);
|
|
1032
|
+
// eslint-disable-next-line no-param-reassign
|
|
1033
|
+
value = JSON.stringify(value);
|
|
1034
|
+
} else if (
|
|
1035
|
+
(utils$2.isArray(value) && isFlatArray$1(value)) ||
|
|
1036
|
+
((utils$2.isFileList(value) || utils$2.endsWith(key, '[]')) && (arr = utils$2.toArray(value))
|
|
1037
|
+
)) {
|
|
1038
|
+
// eslint-disable-next-line no-param-reassign
|
|
1039
|
+
key = removeBrackets$1(key);
|
|
1040
|
+
|
|
1041
|
+
arr.forEach(function each(el, index) {
|
|
1042
|
+
!(utils$2.isUndefined(el) || el === null) && formData.append(
|
|
1043
|
+
// eslint-disable-next-line no-nested-ternary
|
|
1044
|
+
indexes === true ? renderKey$1([key], index, dots) : (indexes === null ? key : key + '[]'),
|
|
1045
|
+
convertValue(el)
|
|
1046
|
+
);
|
|
1047
|
+
});
|
|
1048
|
+
return false;
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
if (isVisitable$1(value)) {
|
|
1053
|
+
return true;
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
formData.append(renderKey$1(path, key, dots), convertValue(value));
|
|
1057
|
+
|
|
1058
|
+
return false;
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
const stack = [];
|
|
1062
|
+
|
|
1063
|
+
const exposedHelpers = Object.assign(predicates$1, {
|
|
1064
|
+
defaultVisitor,
|
|
1065
|
+
convertValue,
|
|
1066
|
+
isVisitable: isVisitable$1
|
|
1067
|
+
});
|
|
1068
|
+
|
|
1069
|
+
function build(value, path) {
|
|
1070
|
+
if (utils$2.isUndefined(value)) return;
|
|
1071
|
+
|
|
1072
|
+
if (stack.indexOf(value) !== -1) {
|
|
1073
|
+
throw Error('Circular reference detected in ' + path.join('.'));
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
stack.push(value);
|
|
1077
|
+
|
|
1078
|
+
utils$2.forEach(value, function each(el, key) {
|
|
1079
|
+
const result = !(utils$2.isUndefined(el) || el === null) && visitor.call(
|
|
1080
|
+
formData, el, utils$2.isString(key) ? key.trim() : key, path, exposedHelpers
|
|
1081
|
+
);
|
|
1082
|
+
|
|
1083
|
+
if (result === true) {
|
|
1084
|
+
build(el, path ? path.concat(key) : [key]);
|
|
1085
|
+
}
|
|
1086
|
+
});
|
|
1087
|
+
|
|
1088
|
+
stack.pop();
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
if (!utils$2.isObject(obj)) {
|
|
1092
|
+
throw new TypeError('data must be an object');
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
build(obj);
|
|
1096
|
+
|
|
1097
|
+
return formData;
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
/**
|
|
1101
|
+
* It encodes a string by replacing all characters that are not in the unreserved set with
|
|
1102
|
+
* their percent-encoded equivalents
|
|
1103
|
+
*
|
|
1104
|
+
* @param {string} str - The string to encode.
|
|
1105
|
+
*
|
|
1106
|
+
* @returns {string} The encoded string.
|
|
1107
|
+
*/
|
|
1108
|
+
function encode$2(str) {
|
|
1109
|
+
const charMap = {
|
|
1110
|
+
'!': '%21',
|
|
1111
|
+
"'": '%27',
|
|
1112
|
+
'(': '%28',
|
|
1113
|
+
')': '%29',
|
|
1114
|
+
'~': '%7E',
|
|
1115
|
+
'%20': '+',
|
|
1116
|
+
'%00': '\x00'
|
|
1117
|
+
};
|
|
1118
|
+
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
|
1119
|
+
return charMap[match];
|
|
1120
|
+
});
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
/**
|
|
1124
|
+
* It takes a params object and converts it to a FormData object
|
|
1125
|
+
*
|
|
1126
|
+
* @param {Object<string, any>} params - The parameters to be converted to a FormData object.
|
|
1127
|
+
* @param {Object<string, any>} options - The options object passed to the Axios constructor.
|
|
1128
|
+
*
|
|
1129
|
+
* @returns {void}
|
|
1130
|
+
*/
|
|
1131
|
+
function AxiosURLSearchParams$1(params, options) {
|
|
1132
|
+
this._pairs = [];
|
|
1133
|
+
|
|
1134
|
+
params && toFormData$2(params, this, options);
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
const prototype$2 = AxiosURLSearchParams$1.prototype;
|
|
1138
|
+
|
|
1139
|
+
prototype$2.append = function append(name, value) {
|
|
1140
|
+
this._pairs.push([name, value]);
|
|
1141
|
+
};
|
|
1142
|
+
|
|
1143
|
+
prototype$2.toString = function toString(encoder) {
|
|
1144
|
+
const _encode = encoder ? function(value) {
|
|
1145
|
+
return encoder.call(this, value, encode$2);
|
|
1146
|
+
} : encode$2;
|
|
1147
|
+
|
|
1148
|
+
return this._pairs.map(function each(pair) {
|
|
1149
|
+
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
|
1150
|
+
}, '').join('&');
|
|
1151
|
+
};
|
|
1152
|
+
|
|
1153
|
+
/**
|
|
1154
|
+
* It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
|
|
1155
|
+
* URI encoded counterparts
|
|
1156
|
+
*
|
|
1157
|
+
* @param {string} val The value to be encoded.
|
|
1158
|
+
*
|
|
1159
|
+
* @returns {string} The encoded value.
|
|
1160
|
+
*/
|
|
1161
|
+
function encode$1(val) {
|
|
1162
|
+
return encodeURIComponent(val).
|
|
1163
|
+
replace(/%3A/gi, ':').
|
|
1164
|
+
replace(/%24/g, '$').
|
|
1165
|
+
replace(/%2C/gi, ',').
|
|
1166
|
+
replace(/%20/g, '+').
|
|
1167
|
+
replace(/%5B/gi, '[').
|
|
1168
|
+
replace(/%5D/gi, ']');
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
/**
|
|
1172
|
+
* Build a URL by appending params to the end
|
|
1173
|
+
*
|
|
1174
|
+
* @param {string} url The base of the url (e.g., http://www.google.com)
|
|
1175
|
+
* @param {object} [params] The params to be appended
|
|
1176
|
+
* @param {?object} options
|
|
1177
|
+
*
|
|
1178
|
+
* @returns {string} The formatted url
|
|
1179
|
+
*/
|
|
1180
|
+
function buildURL(url, params, options) {
|
|
1181
|
+
/*eslint no-param-reassign:0*/
|
|
1182
|
+
if (!params) {
|
|
1183
|
+
return url;
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
const _encode = options && options.encode || encode$1;
|
|
1187
|
+
|
|
1188
|
+
const serializeFn = options && options.serialize;
|
|
1189
|
+
|
|
1190
|
+
let serializedParams;
|
|
1191
|
+
|
|
1192
|
+
if (serializeFn) {
|
|
1193
|
+
serializedParams = serializeFn(params, options);
|
|
1194
|
+
} else {
|
|
1195
|
+
serializedParams = utils$2.isURLSearchParams(params) ?
|
|
1196
|
+
params.toString() :
|
|
1197
|
+
new AxiosURLSearchParams$1(params, options).toString(_encode);
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
if (serializedParams) {
|
|
1201
|
+
const hashmarkIndex = url.indexOf("#");
|
|
1202
|
+
|
|
1203
|
+
if (hashmarkIndex !== -1) {
|
|
1204
|
+
url = url.slice(0, hashmarkIndex);
|
|
1205
|
+
}
|
|
1206
|
+
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
return url;
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
class InterceptorManager {
|
|
1213
|
+
constructor() {
|
|
1214
|
+
this.handlers = [];
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
/**
|
|
1218
|
+
* Add a new interceptor to the stack
|
|
1219
|
+
*
|
|
1220
|
+
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
1221
|
+
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
1222
|
+
*
|
|
1223
|
+
* @return {Number} An ID used to remove interceptor later
|
|
1224
|
+
*/
|
|
1225
|
+
use(fulfilled, rejected, options) {
|
|
1226
|
+
this.handlers.push({
|
|
1227
|
+
fulfilled,
|
|
1228
|
+
rejected,
|
|
1229
|
+
synchronous: options ? options.synchronous : false,
|
|
1230
|
+
runWhen: options ? options.runWhen : null
|
|
1231
|
+
});
|
|
1232
|
+
return this.handlers.length - 1;
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
/**
|
|
1236
|
+
* Remove an interceptor from the stack
|
|
1237
|
+
*
|
|
1238
|
+
* @param {Number} id The ID that was returned by `use`
|
|
1239
|
+
*
|
|
1240
|
+
* @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
|
|
1241
|
+
*/
|
|
1242
|
+
eject(id) {
|
|
1243
|
+
if (this.handlers[id]) {
|
|
1244
|
+
this.handlers[id] = null;
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
/**
|
|
1249
|
+
* Clear all interceptors from the stack
|
|
1250
|
+
*
|
|
1251
|
+
* @returns {void}
|
|
1252
|
+
*/
|
|
1253
|
+
clear() {
|
|
1254
|
+
if (this.handlers) {
|
|
1255
|
+
this.handlers = [];
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
/**
|
|
1260
|
+
* Iterate over all the registered interceptors
|
|
1261
|
+
*
|
|
1262
|
+
* This method is particularly useful for skipping over any
|
|
1263
|
+
* interceptors that may have become `null` calling `eject`.
|
|
1264
|
+
*
|
|
1265
|
+
* @param {Function} fn The function to call for each interceptor
|
|
1266
|
+
*
|
|
1267
|
+
* @returns {void}
|
|
1268
|
+
*/
|
|
1269
|
+
forEach(fn) {
|
|
1270
|
+
utils$2.forEach(this.handlers, function forEachHandler(h) {
|
|
1271
|
+
if (h !== null) {
|
|
1272
|
+
fn(h);
|
|
1273
|
+
}
|
|
1274
|
+
});
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
const InterceptorManager$1 = InterceptorManager;
|
|
1279
|
+
|
|
1280
|
+
const transitionalDefaults = {
|
|
1281
|
+
silentJSONParsing: true,
|
|
1282
|
+
forcedJSONParsing: true,
|
|
1283
|
+
clarifyTimeoutError: false
|
|
1284
|
+
};
|
|
1285
|
+
|
|
6
1286
|
function bind(fn, thisArg) {
|
|
7
1287
|
return function wrap() {
|
|
8
1288
|
return fn.apply(thisArg, arguments);
|
|
@@ -730,8 +2010,15 @@ AxiosError$1.from = (error, code, config, request, response, customProps)=>{
|
|
|
730
2010
|
return axiosError;
|
|
731
2011
|
};
|
|
732
2012
|
|
|
733
|
-
|
|
734
|
-
|
|
2013
|
+
function getDefaultExportFromCjs (x) {
|
|
2014
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
2015
|
+
}
|
|
2016
|
+
|
|
2017
|
+
/* eslint-env browser */
|
|
2018
|
+
|
|
2019
|
+
var browser = typeof self == 'object' ? self.FormData : window.FormData;
|
|
2020
|
+
|
|
2021
|
+
const FormData$2 = /*@__PURE__*/getDefaultExportFromCjs(browser);
|
|
735
2022
|
|
|
736
2023
|
/**
|
|
737
2024
|
* Determines if the given thing is a array or js object.
|
|
@@ -804,7 +2091,7 @@ const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop)
|
|
|
804
2091
|
throw new TypeError('target must be an object');
|
|
805
2092
|
}
|
|
806
2093
|
// eslint-disable-next-line no-param-reassign
|
|
807
|
-
formData = formData || new (FormData)();
|
|
2094
|
+
formData = formData || new (FormData$2 || FormData)();
|
|
808
2095
|
// eslint-disable-next-line no-param-reassign
|
|
809
2096
|
options = utils$1.toFlatObject(options, {
|
|
810
2097
|
metaTokens: true,
|
|
@@ -910,7 +2197,7 @@ const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop)
|
|
|
910
2197
|
* @param {string} str - The string to encode.
|
|
911
2198
|
*
|
|
912
2199
|
* @returns {string} The encoded string.
|
|
913
|
-
*/ function encode
|
|
2200
|
+
*/ function encode(str) {
|
|
914
2201
|
const charMap = {
|
|
915
2202
|
'!': '%21',
|
|
916
2203
|
"'": '%27',
|
|
@@ -942,119 +2229,14 @@ prototype.append = function append(name, value) {
|
|
|
942
2229
|
value
|
|
943
2230
|
]);
|
|
944
2231
|
};
|
|
945
|
-
prototype.toString = function toString(encoder) {
|
|
946
|
-
const _encode = encoder ? function(value) {
|
|
947
|
-
return encoder.call(this, value, encode
|
|
948
|
-
} : encode
|
|
949
|
-
return this._pairs.map(function each(pair) {
|
|
950
|
-
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
|
951
|
-
}, '').join('&');
|
|
952
|
-
};
|
|
953
|
-
|
|
954
|
-
/**
|
|
955
|
-
* It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
|
|
956
|
-
* URI encoded counterparts
|
|
957
|
-
*
|
|
958
|
-
* @param {string} val The value to be encoded.
|
|
959
|
-
*
|
|
960
|
-
* @returns {string} The encoded value.
|
|
961
|
-
*/ function encode(val) {
|
|
962
|
-
return encodeURIComponent(val).replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+').replace(/%5B/gi, '[').replace(/%5D/gi, ']');
|
|
963
|
-
}
|
|
964
|
-
/**
|
|
965
|
-
* Build a URL by appending params to the end
|
|
966
|
-
*
|
|
967
|
-
* @param {string} url The base of the url (e.g., http://www.google.com)
|
|
968
|
-
* @param {object} [params] The params to be appended
|
|
969
|
-
* @param {?object} options
|
|
970
|
-
*
|
|
971
|
-
* @returns {string} The formatted url
|
|
972
|
-
*/ function buildURL(url, params, options) {
|
|
973
|
-
/*eslint no-param-reassign:0*/ if (!params) {
|
|
974
|
-
return url;
|
|
975
|
-
}
|
|
976
|
-
const _encode = options && options.encode || encode;
|
|
977
|
-
const serializeFn = options && options.serialize;
|
|
978
|
-
let serializedParams;
|
|
979
|
-
if (serializeFn) {
|
|
980
|
-
serializedParams = serializeFn(params, options);
|
|
981
|
-
} else {
|
|
982
|
-
serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode);
|
|
983
|
-
}
|
|
984
|
-
if (serializedParams) {
|
|
985
|
-
const hashmarkIndex = url.indexOf("#");
|
|
986
|
-
if (hashmarkIndex !== -1) {
|
|
987
|
-
url = url.slice(0, hashmarkIndex);
|
|
988
|
-
}
|
|
989
|
-
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
|
|
990
|
-
}
|
|
991
|
-
return url;
|
|
992
|
-
}
|
|
993
|
-
|
|
994
|
-
let InterceptorManager = class InterceptorManager {
|
|
995
|
-
constructor(){
|
|
996
|
-
this.handlers = [];
|
|
997
|
-
}
|
|
998
|
-
/**
|
|
999
|
-
* Add a new interceptor to the stack
|
|
1000
|
-
*
|
|
1001
|
-
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
1002
|
-
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
1003
|
-
*
|
|
1004
|
-
* @return {Number} An ID used to remove interceptor later
|
|
1005
|
-
*/ use(fulfilled, rejected, options) {
|
|
1006
|
-
this.handlers.push({
|
|
1007
|
-
fulfilled,
|
|
1008
|
-
rejected,
|
|
1009
|
-
synchronous: options ? options.synchronous : false,
|
|
1010
|
-
runWhen: options ? options.runWhen : null
|
|
1011
|
-
});
|
|
1012
|
-
return this.handlers.length - 1;
|
|
1013
|
-
}
|
|
1014
|
-
/**
|
|
1015
|
-
* Remove an interceptor from the stack
|
|
1016
|
-
*
|
|
1017
|
-
* @param {Number} id The ID that was returned by `use`
|
|
1018
|
-
*
|
|
1019
|
-
* @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
|
|
1020
|
-
*/ eject(id) {
|
|
1021
|
-
if (this.handlers[id]) {
|
|
1022
|
-
this.handlers[id] = null;
|
|
1023
|
-
}
|
|
1024
|
-
}
|
|
1025
|
-
/**
|
|
1026
|
-
* Clear all interceptors from the stack
|
|
1027
|
-
*
|
|
1028
|
-
* @returns {void}
|
|
1029
|
-
*/ clear() {
|
|
1030
|
-
if (this.handlers) {
|
|
1031
|
-
this.handlers = [];
|
|
1032
|
-
}
|
|
1033
|
-
}
|
|
1034
|
-
/**
|
|
1035
|
-
* Iterate over all the registered interceptors
|
|
1036
|
-
*
|
|
1037
|
-
* This method is particularly useful for skipping over any
|
|
1038
|
-
* interceptors that may have become `null` calling `eject`.
|
|
1039
|
-
*
|
|
1040
|
-
* @param {Function} fn The function to call for each interceptor
|
|
1041
|
-
*
|
|
1042
|
-
* @returns {void}
|
|
1043
|
-
*/ forEach(fn) {
|
|
1044
|
-
utils$1.forEach(this.handlers, function forEachHandler(h) {
|
|
1045
|
-
if (h !== null) {
|
|
1046
|
-
fn(h);
|
|
1047
|
-
}
|
|
1048
|
-
});
|
|
1049
|
-
}
|
|
1050
|
-
};
|
|
1051
|
-
const InterceptorManager$1 = InterceptorManager;
|
|
1052
|
-
|
|
1053
|
-
const transitionalDefaults = {
|
|
1054
|
-
silentJSONParsing: true,
|
|
1055
|
-
forcedJSONParsing: true,
|
|
1056
|
-
clarifyTimeoutError: false
|
|
1057
|
-
};
|
|
2232
|
+
prototype.toString = function toString(encoder) {
|
|
2233
|
+
const _encode = encoder ? function(value) {
|
|
2234
|
+
return encoder.call(this, value, encode);
|
|
2235
|
+
} : encode;
|
|
2236
|
+
return this._pairs.map(function each(pair) {
|
|
2237
|
+
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
|
2238
|
+
}, '').join('&');
|
|
2239
|
+
};
|
|
1058
2240
|
|
|
1059
2241
|
const URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
|
|
1060
2242
|
|
|
@@ -1079,8 +2261,10 @@ const platform$1 = {
|
|
|
1079
2261
|
]
|
|
1080
2262
|
};
|
|
1081
2263
|
|
|
1082
|
-
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
1083
|
-
|
|
2264
|
+
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
2265
|
+
|
|
2266
|
+
const _navigator = typeof navigator === 'object' && navigator || undefined;
|
|
2267
|
+
|
|
1084
2268
|
/**
|
|
1085
2269
|
* Determine if we're running in a standard browser environment
|
|
1086
2270
|
*
|
|
@@ -1097,11 +2281,10 @@ const _navigator = typeof navigator === 'object' && navigator || undefined;
|
|
|
1097
2281
|
* navigator.product -> 'NativeScript' or 'NS'
|
|
1098
2282
|
*
|
|
1099
2283
|
* @returns {boolean}
|
|
1100
|
-
*/
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
].indexOf(_navigator.product) < 0);
|
|
2284
|
+
*/
|
|
2285
|
+
const hasStandardBrowserEnv = hasBrowserEnv &&
|
|
2286
|
+
(!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
|
|
2287
|
+
|
|
1105
2288
|
/**
|
|
1106
2289
|
* Determine if we're running in a standard browser webWorker environment
|
|
1107
2290
|
*
|
|
@@ -1110,36 +2293,43 @@ const _navigator = typeof navigator === 'object' && navigator || undefined;
|
|
|
1110
2293
|
* filtered out due to its judgment standard
|
|
1111
2294
|
* `typeof window !== 'undefined' && typeof document !== 'undefined'`.
|
|
1112
2295
|
* This leads to a problem when axios post `FormData` in webWorker
|
|
1113
|
-
*/
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
2296
|
+
*/
|
|
2297
|
+
const hasStandardBrowserWebWorkerEnv = (() => {
|
|
2298
|
+
return (
|
|
2299
|
+
typeof WorkerGlobalScope !== 'undefined' &&
|
|
2300
|
+
// eslint-disable-next-line no-undef
|
|
2301
|
+
self instanceof WorkerGlobalScope &&
|
|
2302
|
+
typeof self.importScripts === 'function'
|
|
2303
|
+
);
|
|
2304
|
+
})();
|
|
2305
|
+
|
|
1117
2306
|
const origin = hasBrowserEnv && window.location.href || 'http://localhost';
|
|
1118
2307
|
|
|
1119
2308
|
const utils = /*#__PURE__*/Object.freeze({
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
2309
|
+
__proto__: null,
|
|
2310
|
+
hasBrowserEnv: hasBrowserEnv,
|
|
2311
|
+
hasStandardBrowserEnv: hasStandardBrowserEnv,
|
|
2312
|
+
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
|
|
2313
|
+
navigator: _navigator,
|
|
2314
|
+
origin: origin
|
|
1126
2315
|
});
|
|
1127
2316
|
|
|
1128
|
-
const platform = {
|
|
1129
|
-
|
|
1130
|
-
|
|
2317
|
+
const platform = {
|
|
2318
|
+
...utils,
|
|
2319
|
+
...platform$1
|
|
1131
2320
|
};
|
|
1132
2321
|
|
|
1133
|
-
function toURLEncodedForm(data, options) {
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
}
|
|
2322
|
+
function toURLEncodedForm(data, options) {
|
|
2323
|
+
return toFormData$2(data, new platform.classes.URLSearchParams(), Object.assign({
|
|
2324
|
+
visitor: function(value, key, path, helpers) {
|
|
2325
|
+
if (platform.isNode && utils$2.isBuffer(value)) {
|
|
2326
|
+
this.append(key, value.toString('base64'));
|
|
2327
|
+
return false;
|
|
2328
|
+
}
|
|
2329
|
+
|
|
2330
|
+
return helpers.defaultVisitor.apply(this, arguments);
|
|
2331
|
+
}
|
|
2332
|
+
}, options));
|
|
1143
2333
|
}
|
|
1144
2334
|
|
|
1145
2335
|
/**
|
|
@@ -1148,74 +2338,88 @@ function toURLEncodedForm(data, options) {
|
|
|
1148
2338
|
* @param {string} name - The name of the property to get.
|
|
1149
2339
|
*
|
|
1150
2340
|
* @returns An array of strings.
|
|
1151
|
-
*/
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
}
|
|
2341
|
+
*/
|
|
2342
|
+
function parsePropPath(name) {
|
|
2343
|
+
// foo[x][y][z]
|
|
2344
|
+
// foo.x.y.z
|
|
2345
|
+
// foo-x-y-z
|
|
2346
|
+
// foo x y z
|
|
2347
|
+
return utils$2.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
|
|
2348
|
+
return match[0] === '[]' ? '' : match[1] || match[0];
|
|
2349
|
+
});
|
|
2350
|
+
}
|
|
2351
|
+
|
|
1160
2352
|
/**
|
|
1161
2353
|
* Convert an array to an object.
|
|
1162
2354
|
*
|
|
1163
2355
|
* @param {Array<any>} arr - The array to convert to an object.
|
|
1164
2356
|
*
|
|
1165
2357
|
* @returns An object with the same keys and values as the array.
|
|
1166
|
-
*/
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
2358
|
+
*/
|
|
2359
|
+
function arrayToObject(arr) {
|
|
2360
|
+
const obj = {};
|
|
2361
|
+
const keys = Object.keys(arr);
|
|
2362
|
+
let i;
|
|
2363
|
+
const len = keys.length;
|
|
2364
|
+
let key;
|
|
2365
|
+
for (i = 0; i < len; i++) {
|
|
2366
|
+
key = keys[i];
|
|
2367
|
+
obj[key] = arr[key];
|
|
2368
|
+
}
|
|
2369
|
+
return obj;
|
|
2370
|
+
}
|
|
2371
|
+
|
|
1178
2372
|
/**
|
|
1179
2373
|
* It takes a FormData object and returns a JavaScript object
|
|
1180
2374
|
*
|
|
1181
2375
|
* @param {string} formData The FormData object to convert to JSON.
|
|
1182
2376
|
*
|
|
1183
2377
|
* @returns {Object<string, any> | null} The converted object.
|
|
1184
|
-
*/
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
if (
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
2378
|
+
*/
|
|
2379
|
+
function formDataToJSON(formData) {
|
|
2380
|
+
function buildPath(path, value, target, index) {
|
|
2381
|
+
let name = path[index++];
|
|
2382
|
+
|
|
2383
|
+
if (name === '__proto__') return true;
|
|
2384
|
+
|
|
2385
|
+
const isNumericKey = Number.isFinite(+name);
|
|
2386
|
+
const isLast = index >= path.length;
|
|
2387
|
+
name = !name && utils$2.isArray(target) ? target.length : name;
|
|
2388
|
+
|
|
2389
|
+
if (isLast) {
|
|
2390
|
+
if (utils$2.hasOwnProp(target, name)) {
|
|
2391
|
+
target[name] = [target[name], value];
|
|
2392
|
+
} else {
|
|
2393
|
+
target[name] = value;
|
|
2394
|
+
}
|
|
2395
|
+
|
|
2396
|
+
return !isNumericKey;
|
|
2397
|
+
}
|
|
2398
|
+
|
|
2399
|
+
if (!target[name] || !utils$2.isObject(target[name])) {
|
|
2400
|
+
target[name] = [];
|
|
2401
|
+
}
|
|
2402
|
+
|
|
2403
|
+
const result = buildPath(path, value, target[name], index);
|
|
2404
|
+
|
|
2405
|
+
if (result && utils$2.isArray(target[name])) {
|
|
2406
|
+
target[name] = arrayToObject(target[name]);
|
|
2407
|
+
}
|
|
2408
|
+
|
|
2409
|
+
return !isNumericKey;
|
|
2410
|
+
}
|
|
2411
|
+
|
|
2412
|
+
if (utils$2.isFormData(formData) && utils$2.isFunction(formData.entries)) {
|
|
2413
|
+
const obj = {};
|
|
2414
|
+
|
|
2415
|
+
utils$2.forEachEntry(formData, (name, value) => {
|
|
2416
|
+
buildPath(parsePropPath(name), value, obj, 0);
|
|
2417
|
+
});
|
|
2418
|
+
|
|
2419
|
+
return obj;
|
|
2420
|
+
}
|
|
2421
|
+
|
|
2422
|
+
return null;
|
|
1219
2423
|
}
|
|
1220
2424
|
|
|
1221
2425
|
/**
|
|
@@ -1227,147 +2431,158 @@ function toURLEncodedForm(data, options) {
|
|
|
1227
2431
|
* @param {Function} encoder - A function that takes a value and returns a string.
|
|
1228
2432
|
*
|
|
1229
2433
|
* @returns {string} A stringified version of the rawValue.
|
|
1230
|
-
*/
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
}
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
}
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
2434
|
+
*/
|
|
2435
|
+
function stringifySafely(rawValue, parser, encoder) {
|
|
2436
|
+
if (utils$2.isString(rawValue)) {
|
|
2437
|
+
try {
|
|
2438
|
+
(parser || JSON.parse)(rawValue);
|
|
2439
|
+
return utils$2.trim(rawValue);
|
|
2440
|
+
} catch (e) {
|
|
2441
|
+
if (e.name !== 'SyntaxError') {
|
|
2442
|
+
throw e;
|
|
2443
|
+
}
|
|
2444
|
+
}
|
|
2445
|
+
}
|
|
2446
|
+
|
|
2447
|
+
return (encoder || JSON.stringify)(rawValue);
|
|
2448
|
+
}
|
|
2449
|
+
|
|
2450
|
+
const defaults = {
|
|
2451
|
+
|
|
2452
|
+
transitional: transitionalDefaults,
|
|
2453
|
+
|
|
2454
|
+
adapter: ['xhr', 'http', 'fetch'],
|
|
2455
|
+
|
|
2456
|
+
transformRequest: [function transformRequest(data, headers) {
|
|
2457
|
+
const contentType = headers.getContentType() || '';
|
|
2458
|
+
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
|
2459
|
+
const isObjectPayload = utils$2.isObject(data);
|
|
2460
|
+
|
|
2461
|
+
if (isObjectPayload && utils$2.isHTMLForm(data)) {
|
|
2462
|
+
data = new FormData(data);
|
|
2463
|
+
}
|
|
2464
|
+
|
|
2465
|
+
const isFormData = utils$2.isFormData(data);
|
|
2466
|
+
|
|
2467
|
+
if (isFormData) {
|
|
2468
|
+
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
2469
|
+
}
|
|
2470
|
+
|
|
2471
|
+
if (utils$2.isArrayBuffer(data) ||
|
|
2472
|
+
utils$2.isBuffer(data) ||
|
|
2473
|
+
utils$2.isStream(data) ||
|
|
2474
|
+
utils$2.isFile(data) ||
|
|
2475
|
+
utils$2.isBlob(data) ||
|
|
2476
|
+
utils$2.isReadableStream(data)
|
|
2477
|
+
) {
|
|
2478
|
+
return data;
|
|
2479
|
+
}
|
|
2480
|
+
if (utils$2.isArrayBufferView(data)) {
|
|
2481
|
+
return data.buffer;
|
|
2482
|
+
}
|
|
2483
|
+
if (utils$2.isURLSearchParams(data)) {
|
|
2484
|
+
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
|
2485
|
+
return data.toString();
|
|
2486
|
+
}
|
|
2487
|
+
|
|
2488
|
+
let isFileList;
|
|
2489
|
+
|
|
2490
|
+
if (isObjectPayload) {
|
|
2491
|
+
if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
|
|
2492
|
+
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
2493
|
+
}
|
|
2494
|
+
|
|
2495
|
+
if ((isFileList = utils$2.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
|
|
2496
|
+
const _FormData = this.env && this.env.FormData;
|
|
2497
|
+
|
|
2498
|
+
return toFormData$2(
|
|
2499
|
+
isFileList ? {'files[]': data} : data,
|
|
2500
|
+
_FormData && new _FormData(),
|
|
2501
|
+
this.formSerializer
|
|
2502
|
+
);
|
|
2503
|
+
}
|
|
2504
|
+
}
|
|
2505
|
+
|
|
2506
|
+
if (isObjectPayload || hasJSONContentType) {
|
|
2507
|
+
headers.setContentType('application/json', false);
|
|
2508
|
+
return stringifySafely(data);
|
|
2509
|
+
}
|
|
2510
|
+
|
|
2511
|
+
return data;
|
|
2512
|
+
}],
|
|
2513
|
+
|
|
2514
|
+
transformResponse: [function transformResponse(data) {
|
|
2515
|
+
const transitional = this.transitional || defaults.transitional;
|
|
2516
|
+
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
2517
|
+
const JSONRequested = this.responseType === 'json';
|
|
2518
|
+
|
|
2519
|
+
if (utils$2.isResponse(data) || utils$2.isReadableStream(data)) {
|
|
2520
|
+
return data;
|
|
2521
|
+
}
|
|
2522
|
+
|
|
2523
|
+
if (data && utils$2.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
|
|
2524
|
+
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
2525
|
+
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
2526
|
+
|
|
2527
|
+
try {
|
|
2528
|
+
return JSON.parse(data);
|
|
2529
|
+
} catch (e) {
|
|
2530
|
+
if (strictJSONParsing) {
|
|
2531
|
+
if (e.name === 'SyntaxError') {
|
|
2532
|
+
throw AxiosError$2.from(e, AxiosError$2.ERR_BAD_RESPONSE, this, null, this.response);
|
|
2533
|
+
}
|
|
2534
|
+
throw e;
|
|
2535
|
+
}
|
|
2536
|
+
}
|
|
2537
|
+
}
|
|
2538
|
+
|
|
2539
|
+
return data;
|
|
2540
|
+
}],
|
|
2541
|
+
|
|
2542
|
+
/**
|
|
1317
2543
|
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
1318
2544
|
* timeout is not created.
|
|
1319
|
-
*/
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
], (method)=>{
|
|
1346
|
-
|
|
1347
|
-
});
|
|
2545
|
+
*/
|
|
2546
|
+
timeout: 0,
|
|
2547
|
+
|
|
2548
|
+
xsrfCookieName: 'XSRF-TOKEN',
|
|
2549
|
+
xsrfHeaderName: 'X-XSRF-TOKEN',
|
|
2550
|
+
|
|
2551
|
+
maxContentLength: -1,
|
|
2552
|
+
maxBodyLength: -1,
|
|
2553
|
+
|
|
2554
|
+
env: {
|
|
2555
|
+
FormData: platform.classes.FormData,
|
|
2556
|
+
Blob: platform.classes.Blob
|
|
2557
|
+
},
|
|
2558
|
+
|
|
2559
|
+
validateStatus: function validateStatus(status) {
|
|
2560
|
+
return status >= 200 && status < 300;
|
|
2561
|
+
},
|
|
2562
|
+
|
|
2563
|
+
headers: {
|
|
2564
|
+
common: {
|
|
2565
|
+
'Accept': 'application/json, text/plain, */*',
|
|
2566
|
+
'Content-Type': undefined
|
|
2567
|
+
}
|
|
2568
|
+
}
|
|
2569
|
+
};
|
|
2570
|
+
|
|
2571
|
+
utils$2.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
|
|
2572
|
+
defaults.headers[method] = {};
|
|
2573
|
+
});
|
|
2574
|
+
|
|
1348
2575
|
const defaults$1 = defaults;
|
|
1349
2576
|
|
|
1350
|
-
// RawAxiosHeaders whose duplicates are ignored by node
|
|
1351
|
-
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
1352
|
-
const ignoreDuplicateOf = utils$
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
'from',
|
|
1360
|
-
'host',
|
|
1361
|
-
'if-modified-since',
|
|
1362
|
-
'if-unmodified-since',
|
|
1363
|
-
'last-modified',
|
|
1364
|
-
'location',
|
|
1365
|
-
'max-forwards',
|
|
1366
|
-
'proxy-authorization',
|
|
1367
|
-
'referer',
|
|
1368
|
-
'retry-after',
|
|
1369
|
-
'user-agent'
|
|
1370
|
-
]);
|
|
2577
|
+
// RawAxiosHeaders whose duplicates are ignored by node
|
|
2578
|
+
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
2579
|
+
const ignoreDuplicateOf = utils$2.toObjectSet([
|
|
2580
|
+
'age', 'authorization', 'content-length', 'content-type', 'etag',
|
|
2581
|
+
'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
|
|
2582
|
+
'last-modified', 'location', 'max-forwards', 'proxy-authorization',
|
|
2583
|
+
'referer', 'retry-after', 'user-agent'
|
|
2584
|
+
]);
|
|
2585
|
+
|
|
1371
2586
|
/**
|
|
1372
2587
|
* Parse headers into an object
|
|
1373
2588
|
*
|
|
@@ -1381,272 +2596,346 @@ const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
|
1381
2596
|
* @param {String} rawHeaders Headers needing to be parsed
|
|
1382
2597
|
*
|
|
1383
2598
|
* @returns {Object} Headers parsed into an object
|
|
1384
|
-
*/
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
});
|
|
2599
|
+
*/
|
|
2600
|
+
const parseHeaders = rawHeaders => {
|
|
2601
|
+
const parsed = {};
|
|
2602
|
+
let key;
|
|
2603
|
+
let val;
|
|
2604
|
+
let i;
|
|
2605
|
+
|
|
2606
|
+
rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
|
|
2607
|
+
i = line.indexOf(':');
|
|
2608
|
+
key = line.substring(0, i).trim().toLowerCase();
|
|
2609
|
+
val = line.substring(i + 1).trim();
|
|
2610
|
+
|
|
2611
|
+
if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
|
|
2612
|
+
return;
|
|
2613
|
+
}
|
|
2614
|
+
|
|
2615
|
+
if (key === 'set-cookie') {
|
|
2616
|
+
if (parsed[key]) {
|
|
2617
|
+
parsed[key].push(val);
|
|
2618
|
+
} else {
|
|
2619
|
+
parsed[key] = [val];
|
|
2620
|
+
}
|
|
2621
|
+
} else {
|
|
2622
|
+
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
2623
|
+
}
|
|
2624
|
+
});
|
|
2625
|
+
|
|
2626
|
+
return parsed;
|
|
2627
|
+
};
|
|
1410
2628
|
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
function normalizeHeader(header) {
|
|
1414
|
-
|
|
1415
|
-
}
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
}
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
});
|
|
1466
|
-
}
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
2629
|
+
const $internals = Symbol('internals');
|
|
2630
|
+
|
|
2631
|
+
function normalizeHeader(header) {
|
|
2632
|
+
return header && String(header).trim().toLowerCase();
|
|
2633
|
+
}
|
|
2634
|
+
|
|
2635
|
+
function normalizeValue(value) {
|
|
2636
|
+
if (value === false || value == null) {
|
|
2637
|
+
return value;
|
|
2638
|
+
}
|
|
2639
|
+
|
|
2640
|
+
return utils$2.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
2641
|
+
}
|
|
2642
|
+
|
|
2643
|
+
function parseTokens(str) {
|
|
2644
|
+
const tokens = Object.create(null);
|
|
2645
|
+
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
2646
|
+
let match;
|
|
2647
|
+
|
|
2648
|
+
while ((match = tokensRE.exec(str))) {
|
|
2649
|
+
tokens[match[1]] = match[2];
|
|
2650
|
+
}
|
|
2651
|
+
|
|
2652
|
+
return tokens;
|
|
2653
|
+
}
|
|
2654
|
+
|
|
2655
|
+
const isValidHeaderName = str => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
2656
|
+
|
|
2657
|
+
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
2658
|
+
if (utils$2.isFunction(filter)) {
|
|
2659
|
+
return filter.call(this, value, header);
|
|
2660
|
+
}
|
|
2661
|
+
|
|
2662
|
+
if (isHeaderNameFilter) {
|
|
2663
|
+
value = header;
|
|
2664
|
+
}
|
|
2665
|
+
|
|
2666
|
+
if (!utils$2.isString(value)) return;
|
|
2667
|
+
|
|
2668
|
+
if (utils$2.isString(filter)) {
|
|
2669
|
+
return value.indexOf(filter) !== -1;
|
|
2670
|
+
}
|
|
2671
|
+
|
|
2672
|
+
if (utils$2.isRegExp(filter)) {
|
|
2673
|
+
return filter.test(value);
|
|
2674
|
+
}
|
|
2675
|
+
}
|
|
2676
|
+
|
|
2677
|
+
function formatHeader(header) {
|
|
2678
|
+
return header
|
|
2679
|
+
.trim()
|
|
2680
|
+
.toLowerCase()
|
|
2681
|
+
.replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
|
2682
|
+
return char.toUpperCase() + str;
|
|
2683
|
+
});
|
|
2684
|
+
}
|
|
2685
|
+
|
|
2686
|
+
function buildAccessors(obj, header) {
|
|
2687
|
+
const accessorName = utils$2.toCamelCase(' ' + header);
|
|
2688
|
+
['get', 'set', 'has'].forEach(methodName => {
|
|
2689
|
+
Object.defineProperty(obj, methodName + accessorName, {
|
|
2690
|
+
value: function (arg1, arg2, arg3) {
|
|
2691
|
+
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
2692
|
+
},
|
|
2693
|
+
configurable: true,
|
|
2694
|
+
});
|
|
2695
|
+
});
|
|
2696
|
+
}
|
|
2697
|
+
|
|
2698
|
+
let AxiosHeaders$1 = class AxiosHeaders {
|
|
2699
|
+
constructor(headers) {
|
|
2700
|
+
headers && this.set(headers);
|
|
2701
|
+
}
|
|
2702
|
+
|
|
2703
|
+
/**
|
|
1473
2704
|
*
|
|
1474
2705
|
* @param {*} header
|
|
1475
2706
|
* @param {*} valueOrRewrite
|
|
1476
2707
|
* @param {*} rewrite true:无论源值是否存在均赋值,false:源值如存在不覆盖,
|
|
1477
2708
|
* undefined:源值不为 false 直接赋值,false 不赋值
|
|
1478
2709
|
* @returns
|
|
1479
|
-
*/
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
}
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
}
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
return
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
2710
|
+
*/
|
|
2711
|
+
set(header, valueOrRewrite, rewrite) {
|
|
2712
|
+
const self = this;
|
|
2713
|
+
|
|
2714
|
+
function setHeader(_value, _header, _rewrite) {
|
|
2715
|
+
const lHeader = normalizeHeader(_header);
|
|
2716
|
+
|
|
2717
|
+
if (!lHeader) {
|
|
2718
|
+
throw new Error('header name must be a non-empty string');
|
|
2719
|
+
}
|
|
2720
|
+
|
|
2721
|
+
const key = utils$2.findKey(self, lHeader);
|
|
2722
|
+
|
|
2723
|
+
if (!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
|
|
2724
|
+
self[key || _header] = normalizeValue(_value);
|
|
2725
|
+
}
|
|
2726
|
+
}
|
|
2727
|
+
|
|
2728
|
+
const setHeaders = (headers, _rewrite) =>
|
|
2729
|
+
utils$2.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
2730
|
+
|
|
2731
|
+
if (utils$2.isPlainObject(header) || header instanceof this.constructor) {
|
|
2732
|
+
setHeaders(header, valueOrRewrite);
|
|
2733
|
+
} else if (utils$2.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
2734
|
+
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
2735
|
+
} else if (utils$2.isHeaders(header)) {
|
|
2736
|
+
for (const [key, value] of header.entries()) {
|
|
2737
|
+
setHeader(value, key, rewrite);
|
|
2738
|
+
}
|
|
2739
|
+
} else {
|
|
2740
|
+
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
2741
|
+
}
|
|
2742
|
+
|
|
2743
|
+
return this;
|
|
2744
|
+
}
|
|
2745
|
+
|
|
2746
|
+
get(header, parser) {
|
|
2747
|
+
header = normalizeHeader(header);
|
|
2748
|
+
|
|
2749
|
+
if (header) {
|
|
2750
|
+
const key = utils$2.findKey(this, header);
|
|
2751
|
+
|
|
2752
|
+
if (key) {
|
|
2753
|
+
const value = this[key];
|
|
2754
|
+
|
|
2755
|
+
if (!parser) {
|
|
2756
|
+
return value;
|
|
2757
|
+
}
|
|
2758
|
+
|
|
2759
|
+
if (parser === true) {
|
|
2760
|
+
return parseTokens(value);
|
|
2761
|
+
}
|
|
2762
|
+
|
|
2763
|
+
if (utils$2.isFunction(parser)) {
|
|
2764
|
+
return parser.call(this, value, key);
|
|
2765
|
+
}
|
|
2766
|
+
|
|
2767
|
+
if (utils$2.isRegExp(parser)) {
|
|
2768
|
+
return parser.exec(value);
|
|
2769
|
+
}
|
|
2770
|
+
|
|
2771
|
+
throw new TypeError('parser must be boolean|regexp|function');
|
|
2772
|
+
}
|
|
2773
|
+
}
|
|
2774
|
+
}
|
|
2775
|
+
|
|
2776
|
+
has(header, matcher) {
|
|
2777
|
+
header = normalizeHeader(header);
|
|
2778
|
+
|
|
2779
|
+
if (header) {
|
|
2780
|
+
const key = utils$2.findKey(this, header);
|
|
2781
|
+
|
|
2782
|
+
return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
|
2783
|
+
}
|
|
2784
|
+
|
|
2785
|
+
return false;
|
|
2786
|
+
}
|
|
2787
|
+
|
|
2788
|
+
delete(header, matcher) {
|
|
2789
|
+
const self = this;
|
|
2790
|
+
let deleted = false;
|
|
2791
|
+
|
|
2792
|
+
function deleteHeader(_header) {
|
|
2793
|
+
_header = normalizeHeader(_header);
|
|
2794
|
+
|
|
2795
|
+
if (_header) {
|
|
2796
|
+
const key = utils$2.findKey(self, _header);
|
|
2797
|
+
|
|
2798
|
+
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
|
|
2799
|
+
delete self[key];
|
|
2800
|
+
|
|
2801
|
+
deleted = true;
|
|
2802
|
+
}
|
|
2803
|
+
}
|
|
2804
|
+
}
|
|
2805
|
+
|
|
2806
|
+
if (utils$2.isArray(header)) {
|
|
2807
|
+
header.forEach(deleteHeader);
|
|
2808
|
+
} else {
|
|
2809
|
+
deleteHeader(header);
|
|
2810
|
+
}
|
|
2811
|
+
|
|
2812
|
+
return deleted;
|
|
2813
|
+
}
|
|
2814
|
+
|
|
2815
|
+
clear(matcher) {
|
|
2816
|
+
const keys = Object.keys(this);
|
|
2817
|
+
let i = keys.length;
|
|
2818
|
+
let deleted = false;
|
|
2819
|
+
|
|
2820
|
+
while (i--) {
|
|
2821
|
+
const key = keys[i];
|
|
2822
|
+
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
2823
|
+
delete this[key];
|
|
2824
|
+
deleted = true;
|
|
2825
|
+
}
|
|
2826
|
+
}
|
|
2827
|
+
|
|
2828
|
+
return deleted;
|
|
2829
|
+
}
|
|
2830
|
+
|
|
2831
|
+
normalize(format) {
|
|
2832
|
+
const self = this;
|
|
2833
|
+
const headers = {};
|
|
2834
|
+
|
|
2835
|
+
utils$2.forEach(this, (value, header) => {
|
|
2836
|
+
const key = utils$2.findKey(headers, header);
|
|
2837
|
+
|
|
2838
|
+
if (key) {
|
|
2839
|
+
self[key] = normalizeValue(value);
|
|
2840
|
+
delete self[header];
|
|
2841
|
+
return;
|
|
2842
|
+
}
|
|
2843
|
+
|
|
2844
|
+
const normalized = format ? formatHeader(header) : String(header).trim();
|
|
2845
|
+
|
|
2846
|
+
if (normalized !== header) {
|
|
2847
|
+
delete self[header];
|
|
2848
|
+
}
|
|
2849
|
+
|
|
2850
|
+
self[normalized] = normalizeValue(value);
|
|
2851
|
+
|
|
2852
|
+
headers[normalized] = true;
|
|
2853
|
+
});
|
|
2854
|
+
|
|
2855
|
+
return this;
|
|
2856
|
+
}
|
|
2857
|
+
|
|
2858
|
+
concat(...targets) {
|
|
2859
|
+
return this.constructor.concat(this, ...targets);
|
|
2860
|
+
}
|
|
2861
|
+
|
|
2862
|
+
toJSON(asStrings) {
|
|
2863
|
+
const obj = Object.create(null);
|
|
2864
|
+
|
|
2865
|
+
utils$2.forEach(this, (value, header) => {
|
|
2866
|
+
value != null && value !== false && (obj[header] = asStrings && utils$2.isArray(value) ? value.join(', ') : value);
|
|
2867
|
+
});
|
|
2868
|
+
|
|
2869
|
+
return obj;
|
|
2870
|
+
}
|
|
2871
|
+
|
|
2872
|
+
[Symbol.iterator]() {
|
|
2873
|
+
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
2874
|
+
}
|
|
2875
|
+
|
|
2876
|
+
toString() {
|
|
2877
|
+
return Object.entries(this.toJSON())
|
|
2878
|
+
.map(([header, value]) => header + ': ' + value)
|
|
2879
|
+
.join('\n');
|
|
2880
|
+
}
|
|
2881
|
+
|
|
2882
|
+
get [Symbol.toStringTag]() {
|
|
2883
|
+
return 'AxiosHeaders';
|
|
2884
|
+
}
|
|
2885
|
+
|
|
2886
|
+
static from(thing) {
|
|
2887
|
+
return thing instanceof this ? thing : new this(thing);
|
|
2888
|
+
}
|
|
2889
|
+
|
|
2890
|
+
static concat(first, ...targets) {
|
|
2891
|
+
const computed = new this(first);
|
|
2892
|
+
|
|
2893
|
+
targets.forEach(target => computed.set(target));
|
|
2894
|
+
|
|
2895
|
+
return computed;
|
|
2896
|
+
}
|
|
2897
|
+
|
|
2898
|
+
static accessor(header) {
|
|
2899
|
+
const internals =
|
|
2900
|
+
(this[$internals] =
|
|
2901
|
+
this[$internals] =
|
|
2902
|
+
{
|
|
2903
|
+
accessors: {},
|
|
2904
|
+
});
|
|
2905
|
+
|
|
2906
|
+
const accessors = internals.accessors;
|
|
2907
|
+
const prototype = this.prototype;
|
|
2908
|
+
|
|
2909
|
+
function defineAccessor(_header) {
|
|
2910
|
+
const lHeader = normalizeHeader(_header);
|
|
2911
|
+
|
|
2912
|
+
if (!accessors[lHeader]) {
|
|
2913
|
+
buildAccessors(prototype, _header);
|
|
2914
|
+
accessors[lHeader] = true;
|
|
2915
|
+
}
|
|
2916
|
+
}
|
|
2917
|
+
|
|
2918
|
+
utils$2.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
2919
|
+
|
|
2920
|
+
return this;
|
|
2921
|
+
}
|
|
2922
|
+
};
|
|
2923
|
+
|
|
2924
|
+
AxiosHeaders$1.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
|
|
2925
|
+
|
|
2926
|
+
// reserved names hotfix
|
|
2927
|
+
utils$2.reduceDescriptors(AxiosHeaders$1.prototype, ({value}, key) => {
|
|
2928
|
+
let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
|
|
2929
|
+
return {
|
|
2930
|
+
get: () => value,
|
|
2931
|
+
set(headerValue) {
|
|
2932
|
+
this[mapped] = headerValue;
|
|
2933
|
+
},
|
|
2934
|
+
};
|
|
2935
|
+
});
|
|
2936
|
+
|
|
2937
|
+
utils$2.freezeMethods(AxiosHeaders$1);
|
|
2938
|
+
|
|
1650
2939
|
const AxiosHeaders$2 = AxiosHeaders$1;
|
|
1651
2940
|
|
|
1652
2941
|
/**
|
|
@@ -1656,20 +2945,24 @@ const AxiosHeaders$2 = AxiosHeaders$1;
|
|
|
1656
2945
|
* @param {?Object} response The response object
|
|
1657
2946
|
*
|
|
1658
2947
|
* @returns {*} The resulting transformed data
|
|
1659
|
-
*/
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
headers.normalize();
|
|
1668
|
-
|
|
2948
|
+
*/
|
|
2949
|
+
function transformData(fns, response) {
|
|
2950
|
+
const config = this || defaults$1;
|
|
2951
|
+
const context = response || config;
|
|
2952
|
+
const headers = AxiosHeaders$2.from(context.headers);
|
|
2953
|
+
let data = context.data;
|
|
2954
|
+
|
|
2955
|
+
utils$2.forEach(fns, function transform(fn) {
|
|
2956
|
+
data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
|
|
2957
|
+
});
|
|
2958
|
+
|
|
2959
|
+
headers.normalize();
|
|
2960
|
+
|
|
2961
|
+
return data;
|
|
1669
2962
|
}
|
|
1670
2963
|
|
|
1671
|
-
function isCancel$1(value) {
|
|
1672
|
-
|
|
2964
|
+
function isCancel$1(value) {
|
|
2965
|
+
return !!(value && value.__CANCEL__);
|
|
1673
2966
|
}
|
|
1674
2967
|
|
|
1675
2968
|
/**
|
|
@@ -1680,13 +2973,15 @@ function isCancel$1(value) {
|
|
|
1680
2973
|
* @param {Object=} request The request.
|
|
1681
2974
|
*
|
|
1682
2975
|
* @returns {CanceledError} The created error.
|
|
1683
|
-
*/
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
2976
|
+
*/
|
|
2977
|
+
function CanceledError$1(message, config, request) {
|
|
2978
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
2979
|
+
AxiosError$2.call(this, message == null ? 'canceled' : message, AxiosError$2.ERR_CANCELED, config, request);
|
|
2980
|
+
this.name = 'CanceledError';
|
|
2981
|
+
}
|
|
2982
|
+
|
|
2983
|
+
utils$2.inherits(CanceledError$1, AxiosError$2, {
|
|
2984
|
+
__CANCEL__: true
|
|
1690
2985
|
});
|
|
1691
2986
|
|
|
1692
2987
|
/**
|
|
@@ -1695,11 +2990,12 @@ utils$1.inherits(CanceledError$1, AxiosError$1, {
|
|
|
1695
2990
|
* @param {string} url The URL to test
|
|
1696
2991
|
*
|
|
1697
2992
|
* @returns {boolean} True if the specified URL is absolute, otherwise false
|
|
1698
|
-
*/
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
2993
|
+
*/
|
|
2994
|
+
function isAbsoluteURL(url) {
|
|
2995
|
+
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
|
2996
|
+
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
|
2997
|
+
// by any combination of letters, digits, plus, period, or hyphen.
|
|
2998
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
1703
2999
|
}
|
|
1704
3000
|
|
|
1705
3001
|
/**
|
|
@@ -1709,8 +3005,11 @@ utils$1.inherits(CanceledError$1, AxiosError$1, {
|
|
|
1709
3005
|
* @param {string} relativeURL The relative URL
|
|
1710
3006
|
*
|
|
1711
3007
|
* @returns {string} The combined URL
|
|
1712
|
-
*/
|
|
1713
|
-
|
|
3008
|
+
*/
|
|
3009
|
+
function combineURLs(baseURL, relativeURL) {
|
|
3010
|
+
return relativeURL
|
|
3011
|
+
? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
|
3012
|
+
: baseURL;
|
|
1714
3013
|
}
|
|
1715
3014
|
|
|
1716
3015
|
/**
|
|
@@ -1722,76 +3021,96 @@ utils$1.inherits(CanceledError$1, AxiosError$1, {
|
|
|
1722
3021
|
* @param {string} requestedURL Absolute or relative URL to combine
|
|
1723
3022
|
*
|
|
1724
3023
|
* @returns {string} The combined full path
|
|
1725
|
-
*/
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
3024
|
+
*/
|
|
3025
|
+
function buildFullPath(baseURL, requestedURL) {
|
|
3026
|
+
if (baseURL && !isAbsoluteURL(requestedURL)) {
|
|
3027
|
+
return combineURLs(baseURL, requestedURL);
|
|
3028
|
+
}
|
|
3029
|
+
return requestedURL;
|
|
1730
3030
|
}
|
|
1731
3031
|
|
|
1732
|
-
const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
}
|
|
3032
|
+
const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
|
3033
|
+
class XhrAdapter {
|
|
3034
|
+
constructor(config) {
|
|
3035
|
+
this.init(config);
|
|
3036
|
+
}
|
|
3037
|
+
|
|
3038
|
+
init(config) {}
|
|
3039
|
+
|
|
3040
|
+
request() {}
|
|
3041
|
+
|
|
3042
|
+
stream() {}
|
|
3043
|
+
}
|
|
3044
|
+
|
|
1741
3045
|
const XhrAdapter$1 = isXHRAdapterSupported && XhrAdapter;
|
|
1742
3046
|
|
|
1743
|
-
const knownAdapters = {
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
};
|
|
3047
|
+
const knownAdapters = {
|
|
3048
|
+
http: HttpAdapter, // browser mode: httpAdapter === null
|
|
3049
|
+
xhr: XhrAdapter$1, // node mode: xhrAdapter === null
|
|
3050
|
+
};
|
|
3051
|
+
|
|
1747
3052
|
/**
|
|
1748
3053
|
* define adapter's name and adapterName to http or xhr
|
|
1749
3054
|
* browser: httpAdapter is null!
|
|
1750
|
-
*/
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
const adapters = {
|
|
1765
|
-
/**
|
|
3055
|
+
*/
|
|
3056
|
+
utils$2.forEach(knownAdapters, (val, key) => {
|
|
3057
|
+
if (val) {
|
|
3058
|
+
try {
|
|
3059
|
+
Object.defineProperty(val, 'name', {value: key});
|
|
3060
|
+
} catch (e) {
|
|
3061
|
+
// eslint-disable-next-line no-empty
|
|
3062
|
+
}
|
|
3063
|
+
Object.defineProperty(val, 'adapterName', {value: key});
|
|
3064
|
+
}
|
|
3065
|
+
});
|
|
3066
|
+
|
|
3067
|
+
const adapters = {
|
|
3068
|
+
/**
|
|
1766
3069
|
* get http or xhr adapter
|
|
1767
3070
|
* @param {*} adapters user pass or ['xhr', 'http']
|
|
1768
3071
|
* @returns
|
|
1769
|
-
*/
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
3072
|
+
*/
|
|
3073
|
+
getAdapter: adapters => {
|
|
3074
|
+
adapters = utils$2.isArray(adapters) ? adapters : [adapters];
|
|
3075
|
+
|
|
3076
|
+
const {length} = adapters;
|
|
3077
|
+
let nameOrAdapter;
|
|
3078
|
+
let adapter;
|
|
3079
|
+
|
|
3080
|
+
// find not null adapter
|
|
3081
|
+
for (let i = 0; i < length; i++) {
|
|
3082
|
+
nameOrAdapter = adapters[i];
|
|
3083
|
+
if (
|
|
3084
|
+
(adapter = utils$2.isString(nameOrAdapter)
|
|
3085
|
+
? knownAdapters[nameOrAdapter.toLowerCase()]
|
|
3086
|
+
: nameOrAdapter)
|
|
3087
|
+
) {
|
|
3088
|
+
break;
|
|
3089
|
+
}
|
|
3090
|
+
}
|
|
3091
|
+
|
|
3092
|
+
if (!adapter) {
|
|
3093
|
+
if (adapter === false) {
|
|
3094
|
+
throw new AxiosError$2(
|
|
3095
|
+
`Adapter ${nameOrAdapter} is not supported by the environment`,
|
|
3096
|
+
'ERR_NOT_SUPPORT'
|
|
3097
|
+
);
|
|
3098
|
+
}
|
|
3099
|
+
|
|
3100
|
+
throw new Error(
|
|
3101
|
+
utils$2.hasOwnProp(knownAdapters, nameOrAdapter)
|
|
3102
|
+
? `Adapter '${nameOrAdapter}' is not available in the build`
|
|
3103
|
+
: `Unknown adapter '${nameOrAdapter}'`
|
|
3104
|
+
);
|
|
3105
|
+
}
|
|
3106
|
+
|
|
3107
|
+
if (!utils$2.isFunction(adapter)) {
|
|
3108
|
+
throw new TypeError('adapter is not a function');
|
|
3109
|
+
}
|
|
3110
|
+
|
|
3111
|
+
return adapter;
|
|
3112
|
+
},
|
|
3113
|
+
adapters: knownAdapters,
|
|
1795
3114
|
};
|
|
1796
3115
|
|
|
1797
3116
|
/**
|
|
@@ -1800,70 +3119,82 @@ const adapters = {
|
|
|
1800
3119
|
* @param {Object} config The config that is to be used for the request
|
|
1801
3120
|
*
|
|
1802
3121
|
* @returns {void}
|
|
1803
|
-
*/
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
3122
|
+
*/
|
|
3123
|
+
function throwIfCancellationRequested(config) {
|
|
3124
|
+
if (config.cancelToken) {
|
|
3125
|
+
config.cancelToken.throwIfRequested();
|
|
3126
|
+
}
|
|
3127
|
+
|
|
3128
|
+
if (config.signal && config.signal.aborted) {
|
|
3129
|
+
throw new CanceledError$1(null, config)
|
|
3130
|
+
}
|
|
3131
|
+
}
|
|
3132
|
+
|
|
1811
3133
|
/**
|
|
1812
3134
|
* Dispatch a request to the server using the configured adapter.
|
|
1813
3135
|
* 请求如有异常,需向外抛出异常,不拦截
|
|
1814
3136
|
* @param {object} config The config that is to be used for the request
|
|
1815
3137
|
*
|
|
1816
3138
|
* @returns {Promise<*>} The Promise to be fulfilled
|
|
1817
|
-
*/
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
}
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
3139
|
+
*/
|
|
3140
|
+
function dispatchRequest(config) {
|
|
3141
|
+
let R;
|
|
3142
|
+
throwIfCancellationRequested(config);
|
|
3143
|
+
|
|
3144
|
+
config.headers = AxiosHeaders$2.from(config.headers);
|
|
3145
|
+
|
|
3146
|
+
// Transform request data
|
|
3147
|
+
config.data = transformData.call(config, config.transformRequest);
|
|
3148
|
+
|
|
3149
|
+
if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
|
|
3150
|
+
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
|
3151
|
+
}
|
|
3152
|
+
|
|
3153
|
+
const Adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
|
|
3154
|
+
const adapter = new Adapter(config);
|
|
3155
|
+
|
|
3156
|
+
if (config.stream) R = adapter.request(this);
|
|
3157
|
+
else {
|
|
3158
|
+
R = adapter.request(this).then(
|
|
3159
|
+
response => {
|
|
3160
|
+
throwIfCancellationRequested(config);
|
|
3161
|
+
|
|
3162
|
+
// Transform response data
|
|
3163
|
+
response.data = transformData.call(config, config.transformResponse, response);
|
|
3164
|
+
// ! body === data
|
|
3165
|
+
Object.defineProperty(response, 'body', {
|
|
3166
|
+
get() {
|
|
3167
|
+
return response.data
|
|
3168
|
+
},
|
|
3169
|
+
});
|
|
3170
|
+
// if (response.data && !response.body) response.body = response.data
|
|
3171
|
+
|
|
3172
|
+
response.headers = AxiosHeaders$2.from(response.headers);
|
|
3173
|
+
|
|
3174
|
+
return response
|
|
3175
|
+
},
|
|
3176
|
+
reason => {
|
|
3177
|
+
if (!isCancel$1(reason)) {
|
|
3178
|
+
throwIfCancellationRequested(config);
|
|
3179
|
+
|
|
3180
|
+
// Transform response data
|
|
3181
|
+
if (reason && reason.response) {
|
|
3182
|
+
reason.response.data = transformData.call(config, config.transformResponse, reason.response);
|
|
3183
|
+
// body === data
|
|
3184
|
+
if (reason.response.data && !reason.response.body) reason.response.body = reason.response.data;
|
|
3185
|
+
reason.response.headers = AxiosHeaders$2.from(reason.response.headers);
|
|
3186
|
+
}
|
|
3187
|
+
}
|
|
3188
|
+
|
|
3189
|
+
return Promise.reject(reason)
|
|
3190
|
+
}
|
|
3191
|
+
);
|
|
3192
|
+
}
|
|
3193
|
+
return R
|
|
1862
3194
|
}
|
|
1863
3195
|
|
|
1864
|
-
const headersToObject = (thing)=>thing instanceof AxiosHeaders$2 ? {
|
|
1865
|
-
|
|
1866
|
-
} : thing;
|
|
3196
|
+
const headersToObject = (thing) => thing instanceof AxiosHeaders$2 ? { ...thing } : thing;
|
|
3197
|
+
|
|
1867
3198
|
/**
|
|
1868
3199
|
* Config-specific merge-function which creates a new config-object
|
|
1869
3200
|
* by merging two configuration objects together.
|
|
@@ -1872,108 +3203,111 @@ const headersToObject = (thing)=>thing instanceof AxiosHeaders$2 ? {
|
|
|
1872
3203
|
* @param {Object} config2
|
|
1873
3204
|
*
|
|
1874
3205
|
* @returns {Object} New object resulting from merging config2 to config1
|
|
1875
|
-
*/
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
}
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
}
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
3206
|
+
*/
|
|
3207
|
+
function mergeConfig$1(config1, config2) {
|
|
3208
|
+
// eslint-disable-next-line no-param-reassign
|
|
3209
|
+
config2 = config2 || {};
|
|
3210
|
+
const config = {};
|
|
3211
|
+
|
|
3212
|
+
function getMergedValue(target, source, caseless) {
|
|
3213
|
+
if (utils$2.isPlainObject(target) && utils$2.isPlainObject(source)) {
|
|
3214
|
+
return utils$2.merge.call({caseless}, target, source);
|
|
3215
|
+
} else if (utils$2.isPlainObject(source)) {
|
|
3216
|
+
return utils$2.merge({}, source);
|
|
3217
|
+
} else if (utils$2.isArray(source)) {
|
|
3218
|
+
return source.slice();
|
|
3219
|
+
}
|
|
3220
|
+
return source;
|
|
3221
|
+
}
|
|
3222
|
+
|
|
3223
|
+
// eslint-disable-next-line consistent-return
|
|
3224
|
+
function mergeDeepProperties(a, b, caseless) {
|
|
3225
|
+
if (!utils$2.isUndefined(b)) {
|
|
3226
|
+
return getMergedValue(a, b, caseless);
|
|
3227
|
+
} else if (!utils$2.isUndefined(a)) {
|
|
3228
|
+
return getMergedValue(undefined, a, caseless);
|
|
3229
|
+
}
|
|
3230
|
+
}
|
|
3231
|
+
|
|
3232
|
+
// eslint-disable-next-line consistent-return
|
|
3233
|
+
function valueFromConfig2(a, b) {
|
|
3234
|
+
if (!utils$2.isUndefined(b)) {
|
|
3235
|
+
return getMergedValue(undefined, b);
|
|
3236
|
+
}
|
|
3237
|
+
}
|
|
3238
|
+
|
|
3239
|
+
// eslint-disable-next-line consistent-return
|
|
3240
|
+
function defaultToConfig2(a, b) {
|
|
3241
|
+
if (!utils$2.isUndefined(b)) {
|
|
3242
|
+
return getMergedValue(undefined, b);
|
|
3243
|
+
} else if (!utils$2.isUndefined(a)) {
|
|
3244
|
+
return getMergedValue(undefined, a);
|
|
3245
|
+
}
|
|
3246
|
+
}
|
|
3247
|
+
|
|
3248
|
+
// eslint-disable-next-line consistent-return
|
|
3249
|
+
function mergeDirectKeys(a, b, prop) {
|
|
3250
|
+
if (prop in config2) {
|
|
3251
|
+
return getMergedValue(a, b);
|
|
3252
|
+
} else if (prop in config1) {
|
|
3253
|
+
return getMergedValue(undefined, a);
|
|
3254
|
+
}
|
|
3255
|
+
}
|
|
3256
|
+
|
|
3257
|
+
const mergeMap = {
|
|
3258
|
+
url: valueFromConfig2,
|
|
3259
|
+
method: valueFromConfig2,
|
|
3260
|
+
data: valueFromConfig2,
|
|
3261
|
+
baseURL: defaultToConfig2,
|
|
3262
|
+
transformRequest: defaultToConfig2,
|
|
3263
|
+
transformResponse: defaultToConfig2,
|
|
3264
|
+
paramsSerializer: defaultToConfig2,
|
|
3265
|
+
timeout: defaultToConfig2,
|
|
3266
|
+
timeoutMessage: defaultToConfig2,
|
|
3267
|
+
withCredentials: defaultToConfig2,
|
|
3268
|
+
withXSRFToken: defaultToConfig2,
|
|
3269
|
+
adapter: defaultToConfig2,
|
|
3270
|
+
responseType: defaultToConfig2,
|
|
3271
|
+
xsrfCookieName: defaultToConfig2,
|
|
3272
|
+
xsrfHeaderName: defaultToConfig2,
|
|
3273
|
+
onUploadProgress: defaultToConfig2,
|
|
3274
|
+
onDownloadProgress: defaultToConfig2,
|
|
3275
|
+
decompress: defaultToConfig2,
|
|
3276
|
+
maxContentLength: defaultToConfig2,
|
|
3277
|
+
maxBodyLength: defaultToConfig2,
|
|
3278
|
+
beforeRedirect: defaultToConfig2,
|
|
3279
|
+
transport: defaultToConfig2,
|
|
3280
|
+
httpAgent: defaultToConfig2,
|
|
3281
|
+
httpsAgent: defaultToConfig2,
|
|
3282
|
+
cancelToken: defaultToConfig2,
|
|
3283
|
+
socketPath: defaultToConfig2,
|
|
3284
|
+
responseEncoding: defaultToConfig2,
|
|
3285
|
+
validateStatus: mergeDirectKeys,
|
|
3286
|
+
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
|
|
3287
|
+
};
|
|
3288
|
+
|
|
3289
|
+
utils$2.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
|
3290
|
+
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
3291
|
+
const configValue = merge(config1[prop], config2[prop], prop);
|
|
3292
|
+
(utils$2.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
3293
|
+
});
|
|
3294
|
+
|
|
3295
|
+
return config;
|
|
1958
3296
|
}
|
|
1959
3297
|
|
|
1960
3298
|
const VERSION$1 = "1.7.7";
|
|
1961
3299
|
|
|
1962
|
-
const validators$1 = {};
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
'
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
|
|
1974
|
-
};
|
|
1975
|
-
});
|
|
1976
|
-
const deprecatedWarnings = {};
|
|
3300
|
+
const validators$1 = {};
|
|
3301
|
+
|
|
3302
|
+
// eslint-disable-next-line func-names
|
|
3303
|
+
['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {
|
|
3304
|
+
validators$1[type] = function validator(thing) {
|
|
3305
|
+
return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
|
|
3306
|
+
};
|
|
3307
|
+
});
|
|
3308
|
+
|
|
3309
|
+
const deprecatedWarnings = {};
|
|
3310
|
+
|
|
1977
3311
|
/**
|
|
1978
3312
|
* Transitional option validator
|
|
1979
3313
|
*
|
|
@@ -1982,30 +3316,44 @@ const deprecatedWarnings = {};
|
|
|
1982
3316
|
* @param {string?} message - some message with additional info
|
|
1983
3317
|
*
|
|
1984
3318
|
* @returns {function}
|
|
1985
|
-
*/
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
3319
|
+
*/
|
|
3320
|
+
validators$1.transitional = function transitional(validator, version, message) {
|
|
3321
|
+
function formatMessage(opt, desc) {
|
|
3322
|
+
return '[Axios v' + VERSION$1 + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
|
|
3323
|
+
}
|
|
3324
|
+
|
|
3325
|
+
// eslint-disable-next-line func-names
|
|
3326
|
+
return (value, opt, opts) => {
|
|
3327
|
+
if (validator === false) {
|
|
3328
|
+
throw new AxiosError$2(
|
|
3329
|
+
formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
|
|
3330
|
+
AxiosError$2.ERR_DEPRECATED
|
|
3331
|
+
);
|
|
3332
|
+
}
|
|
3333
|
+
|
|
3334
|
+
if (version && !deprecatedWarnings[opt]) {
|
|
3335
|
+
deprecatedWarnings[opt] = true;
|
|
3336
|
+
// eslint-disable-next-line no-console
|
|
3337
|
+
console.warn(
|
|
3338
|
+
formatMessage(
|
|
3339
|
+
opt,
|
|
3340
|
+
' has been deprecated since v' + version + ' and will be removed in the near future'
|
|
3341
|
+
)
|
|
3342
|
+
);
|
|
3343
|
+
}
|
|
3344
|
+
|
|
3345
|
+
return validator ? validator(value, opt, opts) : true;
|
|
3346
|
+
};
|
|
3347
|
+
};
|
|
3348
|
+
|
|
3349
|
+
validators$1.spelling = function spelling(correctSpelling) {
|
|
3350
|
+
return (value, opt) => {
|
|
3351
|
+
// eslint-disable-next-line no-console
|
|
3352
|
+
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
|
|
3353
|
+
return true;
|
|
3354
|
+
}
|
|
3355
|
+
};
|
|
3356
|
+
|
|
2009
3357
|
/**
|
|
2010
3358
|
* Assert object's properties type
|
|
2011
3359
|
*
|
|
@@ -2014,53 +3362,58 @@ validators$1.spelling = function spelling(correctSpelling) {
|
|
|
2014
3362
|
* @param {boolean?} allowUnknown
|
|
2015
3363
|
*
|
|
2016
3364
|
* @returns {object}
|
|
2017
|
-
*/
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
}
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
3365
|
+
*/
|
|
3366
|
+
|
|
3367
|
+
function assertOptions(options, schema, allowUnknown) {
|
|
3368
|
+
if (typeof options !== 'object') {
|
|
3369
|
+
throw new AxiosError$2('options must be an object', AxiosError$2.ERR_BAD_OPTION_VALUE);
|
|
3370
|
+
}
|
|
3371
|
+
const keys = Object.keys(options);
|
|
3372
|
+
let i = keys.length;
|
|
3373
|
+
while (i-- > 0) {
|
|
3374
|
+
const opt = keys[i];
|
|
3375
|
+
const validator = schema[opt];
|
|
3376
|
+
if (validator) {
|
|
3377
|
+
const value = options[opt];
|
|
3378
|
+
const result = value === undefined || validator(value, opt, options);
|
|
3379
|
+
if (result !== true) {
|
|
3380
|
+
throw new AxiosError$2('option ' + opt + ' must be ' + result, AxiosError$2.ERR_BAD_OPTION_VALUE);
|
|
3381
|
+
}
|
|
3382
|
+
continue;
|
|
3383
|
+
}
|
|
3384
|
+
if (allowUnknown !== true) {
|
|
3385
|
+
throw new AxiosError$2('Unknown option ' + opt, AxiosError$2.ERR_BAD_OPTION);
|
|
3386
|
+
}
|
|
3387
|
+
}
|
|
3388
|
+
}
|
|
3389
|
+
|
|
3390
|
+
const validator = {
|
|
3391
|
+
assertOptions,
|
|
3392
|
+
validators: validators$1
|
|
2042
3393
|
};
|
|
2043
3394
|
|
|
2044
|
-
const {
|
|
3395
|
+
const {validators} = validator;
|
|
3396
|
+
|
|
2045
3397
|
/**
|
|
2046
3398
|
* Create a new instance of Axios
|
|
2047
3399
|
*
|
|
2048
3400
|
* @param {Object} instanceConfig The default config for the instance
|
|
2049
3401
|
*
|
|
2050
3402
|
* @return {Axios} A new instance of Axios
|
|
2051
|
-
*/
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
3403
|
+
*/
|
|
3404
|
+
let Axios$1 = class Axios {
|
|
3405
|
+
constructor(instanceConfig) {
|
|
3406
|
+
this.defaults = instanceConfig;
|
|
3407
|
+
this.config = this.defaults; // !+++
|
|
3408
|
+
this.interceptors = {
|
|
3409
|
+
request: new InterceptorManager$1(),
|
|
3410
|
+
response: new InterceptorManager$1(),
|
|
3411
|
+
};
|
|
3412
|
+
|
|
3413
|
+
this.init(); // !+++
|
|
3414
|
+
}
|
|
3415
|
+
|
|
3416
|
+
/**
|
|
2064
3417
|
* !+++
|
|
2065
3418
|
* config 属性直接挂在到实例上,方便读取、设置、修改
|
|
2066
3419
|
* 需注意,不要与其属性、方法冲突!!!
|
|
@@ -2073,222 +3426,252 @@ const { validators } = validator;
|
|
|
2073
3426
|
put(url[, data[, config]])
|
|
2074
3427
|
patch(url[, data[, config]])
|
|
2075
3428
|
getUri([config])
|
|
2076
|
-
*/
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
3429
|
+
*/
|
|
3430
|
+
init() {
|
|
3431
|
+
const m = this
|
|
3432
|
+
;[
|
|
3433
|
+
'url',
|
|
3434
|
+
'method',
|
|
3435
|
+
'baseURL',
|
|
3436
|
+
'transformRequest', // [function],
|
|
3437
|
+
'transformResponse',
|
|
3438
|
+
'headers', // {'X-Requested-With': 'XMLHttpRequest'},
|
|
3439
|
+
'params', // {ID: 12345},
|
|
3440
|
+
'paramsSerializer',
|
|
3441
|
+
'body',
|
|
3442
|
+
'data', // {firstName: 'Fred'}, 'Country=Brasil&City=Belo',
|
|
3443
|
+
'timeout', // default is `0` (no timeout)
|
|
3444
|
+
'withCredentials', // default false
|
|
3445
|
+
'adapter', // func
|
|
3446
|
+
'auth', // {username: 'janedoe', password: 's00pers3cret'}
|
|
3447
|
+
'responseType', // default 'json'
|
|
3448
|
+
'responseEncoding', // default 'utf8'
|
|
3449
|
+
'xsrfCookieName', // default 'XSRF-TOKEN'
|
|
3450
|
+
'xsrfHeaderName', // default 'X-XSRF-TOKEN'
|
|
3451
|
+
'onUploadProgress', // func
|
|
3452
|
+
'onDownloadProgress', // func
|
|
3453
|
+
'maxContentLength',
|
|
3454
|
+
'maxBodyLength',
|
|
3455
|
+
'validateStatus', // status => status >= 200 && status < 300;
|
|
3456
|
+
'maxRedirects', // default 21
|
|
3457
|
+
'beforeRedirect', // (options, { headers }) => {}
|
|
3458
|
+
'socketPath', // default null
|
|
3459
|
+
'httpAgent', // new http.Agent({ keepAlive: true }),
|
|
3460
|
+
'httpsAgent', // new https.Agent({ keepAlive: true }),
|
|
3461
|
+
'agent', // {},
|
|
3462
|
+
'cancelToken', // new CancelToken(function (cancel) {}),
|
|
3463
|
+
'signal', // new AbortController().signal,
|
|
3464
|
+
'decompress', // default true
|
|
3465
|
+
'insecureHTTPParser', // default undefined
|
|
3466
|
+
'transitional',
|
|
3467
|
+
'env', // {FormData: window?.FormData || global?.FormData},
|
|
3468
|
+
'formSerializer',
|
|
3469
|
+
'maxRate', // [100 * 1024, 100 * 1024] // upload, download limit
|
|
3470
|
+
].forEach(p =>
|
|
3471
|
+
Object.defineProperty(m, p, {
|
|
3472
|
+
enumerable: true,
|
|
3473
|
+
get() {
|
|
3474
|
+
return m.config[p]
|
|
3475
|
+
},
|
|
3476
|
+
|
|
3477
|
+
set(value) {
|
|
3478
|
+
m.config[p] = value;
|
|
3479
|
+
},
|
|
3480
|
+
})
|
|
3481
|
+
);
|
|
3482
|
+
}
|
|
3483
|
+
|
|
3484
|
+
/**
|
|
2127
3485
|
* Dispatch a request
|
|
2128
3486
|
* 启动执行请求,返回 Promise 实例
|
|
2129
3487
|
* @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
|
|
2130
3488
|
* @param {?Object} config
|
|
2131
3489
|
* @returns {Promise} The Promise to be fulfilled
|
|
2132
|
-
*/
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
3490
|
+
*/
|
|
3491
|
+
async request(configOrUrl, config) {
|
|
3492
|
+
try {
|
|
3493
|
+
return await this._request(configOrUrl, config)
|
|
3494
|
+
} catch (err) {
|
|
3495
|
+
if (err instanceof Error) {
|
|
3496
|
+
let dummy = {};
|
|
3497
|
+
|
|
3498
|
+
Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
|
|
3499
|
+
|
|
3500
|
+
// slice off the Error: ... line
|
|
3501
|
+
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
|
|
3502
|
+
try {
|
|
3503
|
+
if (!err.stack) {
|
|
3504
|
+
err.stack = stack;
|
|
3505
|
+
// match without the 2 top stack lines
|
|
3506
|
+
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
|
|
3507
|
+
err.stack += '\n' + stack;
|
|
3508
|
+
}
|
|
3509
|
+
} catch (e) {
|
|
3510
|
+
// ignore the case where "stack" is an un-writable property
|
|
3511
|
+
}
|
|
3512
|
+
}
|
|
3513
|
+
|
|
3514
|
+
throw err // 抛出异常
|
|
3515
|
+
}
|
|
3516
|
+
}
|
|
3517
|
+
|
|
3518
|
+
/**
|
|
2157
3519
|
* 执行请求
|
|
2158
3520
|
* @param {*} configOrUrl
|
|
2159
3521
|
* @param {*} config
|
|
2160
3522
|
* @param {boolean} [stream = false] - 是否返回 stream
|
|
2161
3523
|
* @returns
|
|
2162
|
-
*/
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
3524
|
+
*/
|
|
3525
|
+
_request(configOrUrl, config, stream = false) {
|
|
3526
|
+
let R = null;
|
|
3527
|
+
|
|
3528
|
+
/* eslint no-param-reassign:0 */
|
|
3529
|
+
// Allow for axios('example/url'[, config]) a la fetch API
|
|
3530
|
+
if (typeof configOrUrl === 'string') {
|
|
3531
|
+
config = config || {};
|
|
3532
|
+
config.url = configOrUrl;
|
|
3533
|
+
} else {
|
|
3534
|
+
config = configOrUrl || {};
|
|
3535
|
+
}
|
|
3536
|
+
|
|
3537
|
+
// ! body as data alias, body ==> data,内部保持data不变
|
|
3538
|
+
if (!config.data && config.body) {
|
|
3539
|
+
config.data = config.body;
|
|
3540
|
+
// config.body = undefined;
|
|
3541
|
+
}
|
|
3542
|
+
|
|
3543
|
+
config = mergeConfig$1(this.defaults, config);
|
|
3544
|
+
|
|
3545
|
+
const {transitional, paramsSerializer, headers} = config;
|
|
3546
|
+
|
|
3547
|
+
if (transitional !== undefined) {
|
|
3548
|
+
validator.assertOptions(
|
|
3549
|
+
transitional,
|
|
3550
|
+
{
|
|
3551
|
+
silentJSONParsing: validators.transitional(validators.boolean),
|
|
3552
|
+
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
3553
|
+
clarifyTimeoutError: validators.transitional(validators.boolean),
|
|
3554
|
+
},
|
|
3555
|
+
false
|
|
3556
|
+
);
|
|
3557
|
+
}
|
|
3558
|
+
|
|
3559
|
+
if (paramsSerializer) {
|
|
3560
|
+
if (utils$2.isFunction(paramsSerializer)) {
|
|
3561
|
+
config.paramsSerializer = {
|
|
3562
|
+
serialize: paramsSerializer,
|
|
3563
|
+
};
|
|
3564
|
+
} else {
|
|
3565
|
+
validator.assertOptions(
|
|
3566
|
+
paramsSerializer,
|
|
3567
|
+
{
|
|
3568
|
+
encode: validators.function,
|
|
3569
|
+
serialize: validators.function,
|
|
3570
|
+
},
|
|
3571
|
+
true
|
|
3572
|
+
);
|
|
3573
|
+
}
|
|
3574
|
+
}
|
|
3575
|
+
|
|
3576
|
+
validator.assertOptions(
|
|
3577
|
+
config,
|
|
3578
|
+
{
|
|
3579
|
+
baseUrl: validators.spelling('baseURL'),
|
|
3580
|
+
withXsrfToken: validators.spelling('withXSRFToken'),
|
|
3581
|
+
},
|
|
3582
|
+
true
|
|
3583
|
+
);
|
|
3584
|
+
|
|
3585
|
+
// Set config.method
|
|
3586
|
+
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
|
3587
|
+
|
|
3588
|
+
// Flatten headers,方法头覆盖通用头
|
|
3589
|
+
const contextHeaders = headers && utils$2.merge(headers.common, headers[config.method]);
|
|
3590
|
+
|
|
3591
|
+
headers &&
|
|
3592
|
+
utils$2.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], method => {
|
|
3593
|
+
delete headers[method];
|
|
3594
|
+
});
|
|
3595
|
+
|
|
3596
|
+
// 源值存在,则不覆盖,contextHeaders 优先于 headers
|
|
3597
|
+
config.headers = AxiosHeaders$2.concat(contextHeaders, headers);
|
|
3598
|
+
|
|
3599
|
+
// filter out skipped interceptors
|
|
3600
|
+
const requestInterceptorChain = []; // 请求拦截器,hook
|
|
3601
|
+
let synchronousRequestInterceptors = true;
|
|
3602
|
+
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
|
3603
|
+
if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
|
|
3604
|
+
return
|
|
3605
|
+
}
|
|
3606
|
+
|
|
3607
|
+
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
3608
|
+
|
|
3609
|
+
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
3610
|
+
});
|
|
3611
|
+
|
|
3612
|
+
const responseInterceptorChain = []; // 响应拦截器,hook
|
|
3613
|
+
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
|
3614
|
+
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
3615
|
+
});
|
|
3616
|
+
|
|
3617
|
+
let promise;
|
|
3618
|
+
let i = 0;
|
|
3619
|
+
let len;
|
|
3620
|
+
debugger
|
|
3621
|
+
// 执行dispatchRequest
|
|
3622
|
+
// !+++ stream
|
|
3623
|
+
if (stream) {
|
|
3624
|
+
config.stream = true;
|
|
3625
|
+
R = dispatchRequest.call(this, config); // not promise
|
|
3626
|
+
} else if (!synchronousRequestInterceptors) {
|
|
3627
|
+
// 异步拦截器
|
|
3628
|
+
const chain = [dispatchRequest.bind(this), undefined]; // dispatchRequest 放入运行链
|
|
3629
|
+
chain.unshift(...requestInterceptorChain); // !*** 插入头
|
|
3630
|
+
chain.push(...responseInterceptorChain); // !*** 加入尾
|
|
3631
|
+
len = chain.length;
|
|
3632
|
+
|
|
3633
|
+
promise = Promise.resolve(config); // promise 对象
|
|
3634
|
+
|
|
3635
|
+
// 传入config配置,按顺序执行
|
|
3636
|
+
while (i < len) promise = promise.then(chain[i++], chain[i++]);
|
|
3637
|
+
|
|
3638
|
+
R = promise;
|
|
3639
|
+
} else {
|
|
3640
|
+
// 同步拦截器
|
|
3641
|
+
len = requestInterceptorChain.length;
|
|
3642
|
+
let newConfig = config;
|
|
3643
|
+
i = 0;
|
|
3644
|
+
|
|
3645
|
+
// 按加入顺序运行 request 拦截器
|
|
3646
|
+
while (i < len) {
|
|
3647
|
+
const onFulfilled = requestInterceptorChain[i++];
|
|
3648
|
+
const onRejected = requestInterceptorChain[i++];
|
|
3649
|
+
try {
|
|
3650
|
+
newConfig = onFulfilled(newConfig); // 执行
|
|
3651
|
+
} catch (error) {
|
|
3652
|
+
onRejected.call(this, error);
|
|
3653
|
+
break
|
|
3654
|
+
}
|
|
3655
|
+
}
|
|
3656
|
+
|
|
3657
|
+
try {
|
|
3658
|
+
promise = dispatchRequest.call(this, newConfig);
|
|
3659
|
+
i = 0;
|
|
3660
|
+
len = responseInterceptorChain.length;
|
|
3661
|
+
|
|
3662
|
+
// 按顺序执行响应 hook
|
|
3663
|
+
while (i < len) promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
|
|
3664
|
+
|
|
3665
|
+
R = promise;
|
|
3666
|
+
} catch (error) {
|
|
3667
|
+
R = Promise.reject(error);
|
|
3668
|
+
}
|
|
3669
|
+
}
|
|
3670
|
+
|
|
3671
|
+
return R
|
|
3672
|
+
}
|
|
3673
|
+
|
|
3674
|
+
/**
|
|
2292
3675
|
* !+++
|
|
2293
3676
|
* 类似 request 库,返回 stream
|
|
2294
3677
|
* stream 模式下,拦截器无效
|
|
@@ -2297,99 +3680,111 @@ const { validators } = validator;
|
|
|
2297
3680
|
* @param {*} configOrUrl
|
|
2298
3681
|
* @param {*} config
|
|
2299
3682
|
* @returns
|
|
2300
|
-
*/
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
3683
|
+
*/
|
|
3684
|
+
stream(configOrUrl, config) {
|
|
3685
|
+
return this._request(configOrUrl, config, true)
|
|
3686
|
+
}
|
|
3687
|
+
|
|
3688
|
+
/**
|
|
2304
3689
|
*
|
|
2305
3690
|
* @param {*} config
|
|
2306
3691
|
* @returns
|
|
2307
|
-
*/
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
}
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
})
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
], function forEachMethodNoData(method) {
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
function
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
}
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
]
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
3692
|
+
*/
|
|
3693
|
+
getUri(config) {
|
|
3694
|
+
config = mergeConfig$1(this.defaults, config);
|
|
3695
|
+
const fullPath = buildFullPath(config.baseURL, config.url);
|
|
3696
|
+
return buildURL(fullPath, config.params, config.paramsSerializer)
|
|
3697
|
+
}
|
|
3698
|
+
};
|
|
3699
|
+
|
|
3700
|
+
// Provide aliases for supported request methods
|
|
3701
|
+
utils$2.forEach(['head', 'options'], function forEachMethodNoData(method) {
|
|
3702
|
+
/* eslint func-names:0 */
|
|
3703
|
+
Axios$1.prototype[method] = function (url, config) {
|
|
3704
|
+
return this.request(
|
|
3705
|
+
mergeConfig$1(config || {}, {
|
|
3706
|
+
method,
|
|
3707
|
+
url,
|
|
3708
|
+
data: (config || {}).data,
|
|
3709
|
+
})
|
|
3710
|
+
)
|
|
3711
|
+
};
|
|
3712
|
+
});
|
|
3713
|
+
|
|
3714
|
+
// delete、get, 与 axios不同,第二个参数为 params,而不是 data
|
|
3715
|
+
utils$2.forEach(['delete', 'get'], function forEachMethodNoData(method) {
|
|
3716
|
+
Axios$1.prototype[method] = function (url, params, config) {
|
|
3717
|
+
return this.request(
|
|
3718
|
+
mergeConfig$1(config || {}, {
|
|
3719
|
+
method,
|
|
3720
|
+
url,
|
|
3721
|
+
params,
|
|
3722
|
+
})
|
|
3723
|
+
)
|
|
3724
|
+
};
|
|
3725
|
+
});
|
|
3726
|
+
|
|
3727
|
+
utils$2.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
3728
|
+
function generateHTTPMethod(isForm) {
|
|
3729
|
+
return function httpMethod(url, data, config) {
|
|
3730
|
+
return this.request(
|
|
3731
|
+
mergeConfig$1(config || {}, {
|
|
3732
|
+
method,
|
|
3733
|
+
headers: isForm
|
|
3734
|
+
? {
|
|
3735
|
+
'Content-Type': 'multipart/form-data',
|
|
3736
|
+
}
|
|
3737
|
+
: {},
|
|
3738
|
+
url,
|
|
3739
|
+
data,
|
|
3740
|
+
})
|
|
3741
|
+
)
|
|
3742
|
+
}
|
|
3743
|
+
}
|
|
3744
|
+
|
|
3745
|
+
Axios$1.prototype[method] = generateHTTPMethod();
|
|
3746
|
+
|
|
3747
|
+
Axios$1.prototype[`${method}Form`] = generateHTTPMethod(true);
|
|
3748
|
+
});
|
|
3749
|
+
|
|
3750
|
+
// stream get, 与 axios不同,第二个参数为 params,而不是 data
|
|
3751
|
+
utils$2.forEach(['gets'], function forEachMethodNoData(method) {
|
|
3752
|
+
Axios$1.prototype[method] = function (url, params, config) {
|
|
3753
|
+
return this.stream(
|
|
3754
|
+
mergeConfig$1(config || {}, {
|
|
3755
|
+
method,
|
|
3756
|
+
url,
|
|
3757
|
+
params,
|
|
3758
|
+
data: (config || {}).data,
|
|
3759
|
+
})
|
|
3760
|
+
)
|
|
3761
|
+
};
|
|
3762
|
+
});
|
|
3763
|
+
|
|
3764
|
+
// stream post put patch
|
|
3765
|
+
utils$2.forEach(['posts', 'puts', 'patchs'], function forEachMethodWithData(method) {
|
|
3766
|
+
function generateStreamMethod(isForm) {
|
|
3767
|
+
return function httpMethod(url, data, config) {
|
|
3768
|
+
return this.stream(
|
|
3769
|
+
mergeConfig$1(config || {}, {
|
|
3770
|
+
method,
|
|
3771
|
+
headers: isForm
|
|
3772
|
+
? {
|
|
3773
|
+
'Content-Type': 'multipart/form-data',
|
|
3774
|
+
}
|
|
3775
|
+
: {},
|
|
3776
|
+
url,
|
|
3777
|
+
data,
|
|
3778
|
+
})
|
|
3779
|
+
)
|
|
3780
|
+
}
|
|
3781
|
+
}
|
|
3782
|
+
|
|
3783
|
+
Axios$1.prototype[method] = generateStreamMethod();
|
|
3784
|
+
|
|
3785
|
+
Axios$1.prototype[`${method}Forms`] = generateStreamMethod(true);
|
|
3786
|
+
});
|
|
3787
|
+
|
|
2393
3788
|
const Axios$2 = Axios$1;
|
|
2394
3789
|
|
|
2395
3790
|
/**
|
|
@@ -2398,103 +3793,130 @@ const Axios$2 = Axios$1;
|
|
|
2398
3793
|
* @param {Function} executor The executor function.
|
|
2399
3794
|
*
|
|
2400
3795
|
* @returns {CancelToken}
|
|
2401
|
-
*/
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
3796
|
+
*/
|
|
3797
|
+
let CancelToken$1 = class CancelToken {
|
|
3798
|
+
constructor(executor) {
|
|
3799
|
+
if (typeof executor !== 'function') {
|
|
3800
|
+
throw new TypeError('executor must be a function.');
|
|
3801
|
+
}
|
|
3802
|
+
|
|
3803
|
+
let resolvePromise;
|
|
3804
|
+
|
|
3805
|
+
this.promise = new Promise(function promiseExecutor(resolve) {
|
|
3806
|
+
resolvePromise = resolve;
|
|
3807
|
+
});
|
|
3808
|
+
|
|
3809
|
+
const token = this;
|
|
3810
|
+
|
|
3811
|
+
// eslint-disable-next-line func-names
|
|
3812
|
+
this.promise.then(cancel => {
|
|
3813
|
+
if (!token._listeners) return;
|
|
3814
|
+
|
|
3815
|
+
let i = token._listeners.length;
|
|
3816
|
+
|
|
3817
|
+
while (i-- > 0) {
|
|
3818
|
+
token._listeners[i](cancel);
|
|
3819
|
+
}
|
|
3820
|
+
token._listeners = null;
|
|
3821
|
+
});
|
|
3822
|
+
|
|
3823
|
+
// eslint-disable-next-line func-names
|
|
3824
|
+
this.promise.then = onfulfilled => {
|
|
3825
|
+
let _resolve;
|
|
3826
|
+
// eslint-disable-next-line func-names
|
|
3827
|
+
const promise = new Promise(resolve => {
|
|
3828
|
+
token.subscribe(resolve);
|
|
3829
|
+
_resolve = resolve;
|
|
3830
|
+
}).then(onfulfilled);
|
|
3831
|
+
|
|
3832
|
+
promise.cancel = function reject() {
|
|
3833
|
+
token.unsubscribe(_resolve);
|
|
3834
|
+
};
|
|
3835
|
+
|
|
3836
|
+
return promise;
|
|
3837
|
+
};
|
|
3838
|
+
|
|
3839
|
+
executor(function cancel(message, config, request) {
|
|
3840
|
+
if (token.reason) {
|
|
3841
|
+
// Cancellation has already been requested
|
|
3842
|
+
return;
|
|
3843
|
+
}
|
|
3844
|
+
|
|
3845
|
+
token.reason = new CanceledError$1(message, config, request);
|
|
3846
|
+
resolvePromise(token.reason);
|
|
3847
|
+
});
|
|
3848
|
+
}
|
|
3849
|
+
|
|
3850
|
+
/**
|
|
2443
3851
|
* Throws a `CanceledError` if cancellation has been requested.
|
|
2444
|
-
*/
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
}
|
|
2449
|
-
|
|
3852
|
+
*/
|
|
3853
|
+
throwIfRequested() {
|
|
3854
|
+
if (this.reason) {
|
|
3855
|
+
throw this.reason;
|
|
3856
|
+
}
|
|
3857
|
+
}
|
|
3858
|
+
|
|
3859
|
+
/**
|
|
2450
3860
|
* Subscribe to the cancel signal
|
|
2451
|
-
*/
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
}
|
|
2464
|
-
|
|
3861
|
+
*/
|
|
3862
|
+
|
|
3863
|
+
subscribe(listener) {
|
|
3864
|
+
if (this.reason) {
|
|
3865
|
+
listener(this.reason);
|
|
3866
|
+
return;
|
|
3867
|
+
}
|
|
3868
|
+
|
|
3869
|
+
if (this._listeners) {
|
|
3870
|
+
this._listeners.push(listener);
|
|
3871
|
+
} else {
|
|
3872
|
+
this._listeners = [listener];
|
|
3873
|
+
}
|
|
3874
|
+
}
|
|
3875
|
+
|
|
3876
|
+
/**
|
|
2465
3877
|
* Unsubscribe from the cancel signal
|
|
2466
|
-
*/
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
}
|
|
2484
|
-
|
|
3878
|
+
*/
|
|
3879
|
+
|
|
3880
|
+
unsubscribe(listener) {
|
|
3881
|
+
if (!this._listeners) {
|
|
3882
|
+
return;
|
|
3883
|
+
}
|
|
3884
|
+
const index = this._listeners.indexOf(listener);
|
|
3885
|
+
if (index !== -1) {
|
|
3886
|
+
this._listeners.splice(index, 1);
|
|
3887
|
+
}
|
|
3888
|
+
}
|
|
3889
|
+
|
|
3890
|
+
toAbortSignal() {
|
|
3891
|
+
const controller = new AbortController();
|
|
3892
|
+
|
|
3893
|
+
const abort = (err) => {
|
|
3894
|
+
controller.abort(err);
|
|
3895
|
+
};
|
|
3896
|
+
|
|
3897
|
+
this.subscribe(abort);
|
|
3898
|
+
|
|
3899
|
+
controller.signal.unsubscribe = () => this.unsubscribe(abort);
|
|
3900
|
+
|
|
3901
|
+
return controller.signal;
|
|
3902
|
+
}
|
|
3903
|
+
|
|
3904
|
+
/**
|
|
2485
3905
|
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
2486
3906
|
* cancels the `CancelToken`.
|
|
2487
|
-
*/
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
}
|
|
2497
|
-
}
|
|
3907
|
+
*/
|
|
3908
|
+
static source() {
|
|
3909
|
+
let cancel;
|
|
3910
|
+
const token = new CancelToken(function executor(c) {
|
|
3911
|
+
cancel = c;
|
|
3912
|
+
});
|
|
3913
|
+
return {
|
|
3914
|
+
token,
|
|
3915
|
+
cancel
|
|
3916
|
+
};
|
|
3917
|
+
}
|
|
3918
|
+
};
|
|
3919
|
+
|
|
2498
3920
|
const CancelToken$2 = CancelToken$1;
|
|
2499
3921
|
|
|
2500
3922
|
/**
|
|
@@ -2517,10 +3939,11 @@ const CancelToken$2 = CancelToken$1;
|
|
|
2517
3939
|
* @param {Function} callback
|
|
2518
3940
|
*
|
|
2519
3941
|
* @returns {Function}
|
|
2520
|
-
*/
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
3942
|
+
*/
|
|
3943
|
+
function spread$1(callback) {
|
|
3944
|
+
return function wrap(arr) {
|
|
3945
|
+
return callback.apply(null, arr);
|
|
3946
|
+
};
|
|
2524
3947
|
}
|
|
2525
3948
|
|
|
2526
3949
|
/**
|
|
@@ -2529,8 +3952,9 @@ const CancelToken$2 = CancelToken$1;
|
|
|
2529
3952
|
* @param {*} payload The value to test
|
|
2530
3953
|
*
|
|
2531
3954
|
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
|
2532
|
-
*/
|
|
2533
|
-
|
|
3955
|
+
*/
|
|
3956
|
+
function isAxiosError$1(payload) {
|
|
3957
|
+
return utils$2.isObject(payload) && (payload.isAxiosError === true);
|
|
2534
3958
|
}
|
|
2535
3959
|
|
|
2536
3960
|
/**
|
|
@@ -2539,71 +3963,86 @@ const CancelToken$2 = CancelToken$1;
|
|
|
2539
3963
|
* @param {Object} defaultConfig The default config for the instance
|
|
2540
3964
|
*
|
|
2541
3965
|
* @returns {Axios} A new instance of Axios
|
|
2542
|
-
*/
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
//
|
|
2562
|
-
req
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
req.
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
req.
|
|
2569
|
-
|
|
2570
|
-
req.
|
|
2571
|
-
|
|
2572
|
-
req.
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
req.
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
req.
|
|
2582
|
-
|
|
2583
|
-
req.
|
|
2584
|
-
|
|
3966
|
+
*/
|
|
3967
|
+
function createInstance(defaultConfig) {
|
|
3968
|
+
const context = new Axios$2(defaultConfig);
|
|
3969
|
+
const instance = bind$1(Axios$2.prototype.request, context);
|
|
3970
|
+
|
|
3971
|
+
// Copy axios.prototype to instance
|
|
3972
|
+
utils$2.extend(instance, Axios$2.prototype, context, {allOwnKeys: true});
|
|
3973
|
+
|
|
3974
|
+
// Copy context to instance
|
|
3975
|
+
utils$2.extend(instance, context, null, {allOwnKeys: true});
|
|
3976
|
+
|
|
3977
|
+
// Factory for creating new instances
|
|
3978
|
+
instance.create = function create(instanceConfig) {
|
|
3979
|
+
return createInstance(mergeConfig$1(defaultConfig, instanceConfig));
|
|
3980
|
+
};
|
|
3981
|
+
|
|
3982
|
+
return instance;
|
|
3983
|
+
}
|
|
3984
|
+
|
|
3985
|
+
// Create the default instance to be exported
|
|
3986
|
+
const req = createInstance(defaults$1);
|
|
3987
|
+
|
|
3988
|
+
// Expose Axios class to allow class inheritance
|
|
3989
|
+
req.Axios = Axios$2;
|
|
3990
|
+
|
|
3991
|
+
// Expose Cancel & CancelToken
|
|
3992
|
+
req.CanceledError = CanceledError$1;
|
|
3993
|
+
req.CancelToken = CancelToken$2;
|
|
3994
|
+
req.isCancel = isCancel$1;
|
|
3995
|
+
req.VERSION = VERSION$1;
|
|
3996
|
+
req.toFormData = toFormData$2;
|
|
3997
|
+
|
|
3998
|
+
// Expose AxiosError class
|
|
3999
|
+
req.AxiosError = AxiosError$2;
|
|
4000
|
+
|
|
4001
|
+
// alias for CanceledError for backward compatibility
|
|
4002
|
+
req.Cancel = req.CanceledError;
|
|
4003
|
+
|
|
4004
|
+
// Expose all/spread
|
|
4005
|
+
req.all = promises => Promise.all(promises);
|
|
4006
|
+
|
|
4007
|
+
req.spread = spread$1;
|
|
4008
|
+
|
|
4009
|
+
// Expose isAxiosError
|
|
4010
|
+
req.isAxiosError = isAxiosError$1;
|
|
4011
|
+
|
|
4012
|
+
// Expose mergeConfig
|
|
4013
|
+
req.mergeConfig = mergeConfig$1;
|
|
4014
|
+
|
|
4015
|
+
req.AxiosHeaders = AxiosHeaders$2;
|
|
4016
|
+
|
|
4017
|
+
req.formToJSON = thing => formDataToJSON(utils$2.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
4018
|
+
|
|
4019
|
+
req.getAdapter = adapters.getAdapter;
|
|
4020
|
+
|
|
4021
|
+
req.default = req;
|
|
4022
|
+
|
|
4023
|
+
// this module should only have a default export
|
|
2585
4024
|
const req$1 = req;
|
|
2586
4025
|
|
|
2587
4026
|
// This module is intended to unwrap Axios default export as named.
|
|
2588
4027
|
// Keep top-level export same with static properties
|
|
2589
4028
|
// so that it can keep same with es module or cjs
|
|
2590
4029
|
const {
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
4030
|
+
Axios,
|
|
4031
|
+
AxiosError,
|
|
4032
|
+
CanceledError,
|
|
4033
|
+
isCancel,
|
|
4034
|
+
CancelToken,
|
|
4035
|
+
VERSION,
|
|
4036
|
+
all,
|
|
4037
|
+
Cancel,
|
|
4038
|
+
isAxiosError,
|
|
4039
|
+
spread,
|
|
4040
|
+
toFormData,
|
|
4041
|
+
AxiosHeaders,
|
|
4042
|
+
HttpStatusCode,
|
|
4043
|
+
formToJSON,
|
|
4044
|
+
getAdapter,
|
|
4045
|
+
mergeConfig,
|
|
2607
4046
|
} = req$1;
|
|
2608
4047
|
|
|
2609
4048
|
export { Axios, AxiosError, AxiosHeaders, Cancel, CancelToken, CanceledError, HttpStatusCode, VERSION, all, req$1 as default, formToJSON, getAdapter, isAxiosError, isCancel, mergeConfig, spread, toFormData };
|