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