axios 0.21.4 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +318 -54
- package/README.md +378 -64
- package/SECURITY.md +3 -3
- package/UPGRADE_GUIDE.md +41 -13
- package/bin/check-build-version.js +19 -0
- package/bin/ssl_hotfix.js +22 -0
- package/dist/axios.js +2072 -1878
- package/dist/axios.js.map +1 -0
- package/dist/axios.min.js +2 -3
- package/dist/axios.min.js.map +1 -0
- package/dist/esm/axios.js +2379 -0
- package/dist/esm/axios.js.map +1 -0
- package/dist/esm/axios.min.js +2 -0
- package/dist/esm/axios.min.js.map +1 -0
- package/index.d.ts +219 -46
- package/lib/adapters/http.js +262 -130
- package/lib/adapters/xhr.js +59 -22
- package/lib/axios.js +19 -7
- package/lib/cancel/CancelToken.js +65 -4
- package/lib/cancel/CanceledError.js +24 -0
- package/lib/core/Axios.js +45 -17
- package/lib/core/AxiosError.js +97 -0
- package/lib/core/InterceptorManager.js +9 -0
- package/lib/core/buildFullPath.js +5 -2
- package/lib/core/dispatchRequest.js +13 -1
- package/lib/core/mergeConfig.js +54 -38
- package/lib/core/settle.js +3 -3
- package/lib/core/transformData.js +4 -3
- package/lib/{defaults.js → defaults/index.js} +64 -23
- package/lib/defaults/transitional.js +7 -0
- package/lib/env/README.md +3 -0
- package/lib/env/classes/FormData.js +2 -0
- package/lib/env/data.js +3 -0
- package/lib/helpers/AxiosURLSearchParams.js +42 -0
- package/lib/helpers/bind.js +1 -5
- package/lib/helpers/buildURL.js +18 -33
- package/lib/helpers/combineURLs.js +1 -1
- package/lib/helpers/formDataToJSON.js +74 -0
- package/lib/helpers/fromDataURI.js +51 -0
- package/lib/helpers/isAbsoluteURL.js +1 -1
- package/lib/helpers/isAxiosError.js +3 -1
- package/lib/helpers/isURLSameOrigin.js +12 -12
- package/lib/helpers/null.js +2 -0
- package/lib/helpers/parseHeaders.js +2 -2
- package/lib/helpers/parseProtocol.js +6 -0
- package/lib/helpers/toFormData.js +179 -0
- package/lib/helpers/toURLEncodedForm.js +18 -0
- package/lib/helpers/validator.js +14 -33
- package/lib/platform/browser/classes/FormData.js +3 -0
- package/lib/platform/browser/classes/URLSearchParams.js +5 -0
- package/lib/platform/browser/index.js +11 -0
- package/lib/platform/index.js +3 -0
- package/lib/platform/node/classes/FormData.js +3 -0
- package/lib/platform/node/classes/URLSearchParams.js +5 -0
- package/lib/platform/node/index.js +11 -0
- package/lib/utils.js +210 -37
- package/package.json +42 -26
- package/rollup.config.js +60 -0
- package/tsconfig.json +14 -0
- package/tslint.json +6 -0
- package/dist/axios.map +0 -1
- package/dist/axios.min.map +0 -1
- package/lib/cancel/Cancel.js +0 -19
- package/lib/core/createError.js +0 -18
- package/lib/core/enhanceError.js +0 -42
package/dist/axios.js
CHANGED
@@ -1,2193 +1,2387 @@
|
|
1
|
-
|
2
|
-
(function
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
}
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
/******/ // Object.prototype.hasOwnProperty.call
|
88
|
-
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
89
|
-
/******/
|
90
|
-
/******/ // __webpack_public_path__
|
91
|
-
/******/ __webpack_require__.p = "";
|
92
|
-
/******/
|
93
|
-
/******/
|
94
|
-
/******/ // Load entry module and return exports
|
95
|
-
/******/ return __webpack_require__(__webpack_require__.s = "./index.js");
|
96
|
-
/******/ })
|
97
|
-
/************************************************************************/
|
98
|
-
/******/ ({
|
99
|
-
|
100
|
-
/***/ "./index.js":
|
101
|
-
/*!******************!*\
|
102
|
-
!*** ./index.js ***!
|
103
|
-
\******************/
|
104
|
-
/*! no static exports found */
|
105
|
-
/***/ (function(module, exports, __webpack_require__) {
|
106
|
-
|
107
|
-
module.exports = __webpack_require__(/*! ./lib/axios */ "./lib/axios.js");
|
108
|
-
|
109
|
-
/***/ }),
|
110
|
-
|
111
|
-
/***/ "./lib/adapters/xhr.js":
|
112
|
-
/*!*****************************!*\
|
113
|
-
!*** ./lib/adapters/xhr.js ***!
|
114
|
-
\*****************************/
|
115
|
-
/*! no static exports found */
|
116
|
-
/***/ (function(module, exports, __webpack_require__) {
|
117
|
-
|
118
|
-
"use strict";
|
119
|
-
|
120
|
-
|
121
|
-
var utils = __webpack_require__(/*! ./../utils */ "./lib/utils.js");
|
122
|
-
var settle = __webpack_require__(/*! ./../core/settle */ "./lib/core/settle.js");
|
123
|
-
var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./lib/helpers/cookies.js");
|
124
|
-
var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./lib/helpers/buildURL.js");
|
125
|
-
var buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "./lib/core/buildFullPath.js");
|
126
|
-
var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./lib/helpers/parseHeaders.js");
|
127
|
-
var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./lib/helpers/isURLSameOrigin.js");
|
128
|
-
var createError = __webpack_require__(/*! ../core/createError */ "./lib/core/createError.js");
|
129
|
-
|
130
|
-
module.exports = function xhrAdapter(config) {
|
131
|
-
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
132
|
-
var requestData = config.data;
|
133
|
-
var requestHeaders = config.headers;
|
134
|
-
var responseType = config.responseType;
|
135
|
-
|
136
|
-
if (utils.isFormData(requestData)) {
|
137
|
-
delete requestHeaders['Content-Type']; // Let the browser set it
|
1
|
+
// axios v0.30.0 Copyright (c) 2025 Matt Zabriskie
|
2
|
+
(function (global, factory) {
|
3
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
4
|
+
typeof define === 'function' && define.amd ? define(factory) :
|
5
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.axios = factory());
|
6
|
+
})(this, (function () { 'use strict';
|
7
|
+
|
8
|
+
var bind = function bind(fn, thisArg) {
|
9
|
+
return function wrap() {
|
10
|
+
return fn.apply(thisArg, arguments);
|
11
|
+
};
|
12
|
+
};
|
13
|
+
|
14
|
+
// utils is a library of generic helper functions non-specific to axios
|
15
|
+
|
16
|
+
var toString = Object.prototype.toString;
|
17
|
+
|
18
|
+
// eslint-disable-next-line func-names
|
19
|
+
var kindOf = (function(cache) {
|
20
|
+
// eslint-disable-next-line func-names
|
21
|
+
return function(thing) {
|
22
|
+
var str = toString.call(thing);
|
23
|
+
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
24
|
+
};
|
25
|
+
})(Object.create(null));
|
26
|
+
|
27
|
+
function kindOfTest(type) {
|
28
|
+
type = type.toLowerCase();
|
29
|
+
return function isKindOf(thing) {
|
30
|
+
return kindOf(thing) === type;
|
31
|
+
};
|
32
|
+
}
|
33
|
+
|
34
|
+
/**
|
35
|
+
* Determine if a value is an Array
|
36
|
+
*
|
37
|
+
* @param {Object} val The value to test
|
38
|
+
* @returns {boolean} True if value is an Array, otherwise false
|
39
|
+
*/
|
40
|
+
function isArray(val) {
|
41
|
+
return Array.isArray(val);
|
42
|
+
}
|
43
|
+
|
44
|
+
/**
|
45
|
+
* Determine if a value is undefined
|
46
|
+
*
|
47
|
+
* @param {Object} val The value to test
|
48
|
+
* @returns {boolean} True if the value is undefined, otherwise false
|
49
|
+
*/
|
50
|
+
function isUndefined(val) {
|
51
|
+
return typeof val === 'undefined';
|
52
|
+
}
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Determine if a value is a Buffer
|
56
|
+
*
|
57
|
+
* @param {Object} val The value to test
|
58
|
+
* @returns {boolean} True if value is a Buffer, otherwise false
|
59
|
+
*/
|
60
|
+
function isBuffer(val) {
|
61
|
+
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
|
62
|
+
&& typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
|
63
|
+
}
|
64
|
+
|
65
|
+
/**
|
66
|
+
* Determine if a value is an ArrayBuffer
|
67
|
+
*
|
68
|
+
* @function
|
69
|
+
* @param {Object} val The value to test
|
70
|
+
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
71
|
+
*/
|
72
|
+
var isArrayBuffer = kindOfTest('ArrayBuffer');
|
73
|
+
|
74
|
+
|
75
|
+
/**
|
76
|
+
* Determine if a value is a view on an ArrayBuffer
|
77
|
+
*
|
78
|
+
* @param {Object} val The value to test
|
79
|
+
* @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
|
80
|
+
*/
|
81
|
+
function isArrayBufferView(val) {
|
82
|
+
var result;
|
83
|
+
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
|
84
|
+
result = ArrayBuffer.isView(val);
|
85
|
+
} else {
|
86
|
+
result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
|
138
87
|
}
|
88
|
+
return result;
|
89
|
+
}
|
90
|
+
|
91
|
+
/**
|
92
|
+
* Determine if a value is a String
|
93
|
+
*
|
94
|
+
* @param {Object} val The value to test
|
95
|
+
* @returns {boolean} True if value is a String, otherwise false
|
96
|
+
*/
|
97
|
+
function isString(val) {
|
98
|
+
return typeof val === 'string';
|
99
|
+
}
|
139
100
|
|
140
|
-
|
101
|
+
/**
|
102
|
+
* Determine if a value is a Number
|
103
|
+
*
|
104
|
+
* @param {Object} val The value to test
|
105
|
+
* @returns {boolean} True if value is a Number, otherwise false
|
106
|
+
*/
|
107
|
+
function isNumber(val) {
|
108
|
+
return typeof val === 'number';
|
109
|
+
}
|
110
|
+
|
111
|
+
/**
|
112
|
+
* Determine if a value is an Object
|
113
|
+
*
|
114
|
+
* @param {Object} val The value to test
|
115
|
+
* @returns {boolean} True if value is an Object, otherwise false
|
116
|
+
*/
|
117
|
+
function isObject(val) {
|
118
|
+
return val !== null && typeof val === 'object';
|
119
|
+
}
|
141
120
|
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
121
|
+
/**
|
122
|
+
* Determine if a value is a plain Object
|
123
|
+
*
|
124
|
+
* @param {Object} val The value to test
|
125
|
+
* @return {boolean} True if value is a plain Object, otherwise false
|
126
|
+
*/
|
127
|
+
function isPlainObject(val) {
|
128
|
+
if (kindOf(val) !== 'object') {
|
129
|
+
return false;
|
147
130
|
}
|
148
131
|
|
149
|
-
var
|
150
|
-
|
132
|
+
var prototype = Object.getPrototypeOf(val);
|
133
|
+
return prototype === null || prototype === Object.prototype;
|
134
|
+
}
|
151
135
|
|
152
|
-
|
153
|
-
|
136
|
+
/**
|
137
|
+
* Determine if a value is a empty Object
|
138
|
+
*
|
139
|
+
* @param {Object} val The value to test
|
140
|
+
* @return {boolean} True if value is a empty Object, otherwise false
|
141
|
+
*/
|
142
|
+
function isEmptyObject(val) {
|
143
|
+
return val && Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
144
|
+
}
|
154
145
|
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
146
|
+
/**
|
147
|
+
* Determine if a value is a Date
|
148
|
+
*
|
149
|
+
* @function
|
150
|
+
* @param {Object} val The value to test
|
151
|
+
* @returns {boolean} True if value is a Date, otherwise false
|
152
|
+
*/
|
153
|
+
var isDate = kindOfTest('Date');
|
154
|
+
|
155
|
+
/**
|
156
|
+
* Determine if a value is a File
|
157
|
+
*
|
158
|
+
* @function
|
159
|
+
* @param {Object} val The value to test
|
160
|
+
* @returns {boolean} True if value is a File, otherwise false
|
161
|
+
*/
|
162
|
+
var isFile = kindOfTest('File');
|
163
|
+
|
164
|
+
/**
|
165
|
+
* Determine if a value is a Blob
|
166
|
+
*
|
167
|
+
* @function
|
168
|
+
* @param {Object} val The value to test
|
169
|
+
* @returns {boolean} True if value is a Blob, otherwise false
|
170
|
+
*/
|
171
|
+
var isBlob = kindOfTest('Blob');
|
172
|
+
|
173
|
+
/**
|
174
|
+
* Determine if a value is a FileList
|
175
|
+
*
|
176
|
+
* @function
|
177
|
+
* @param {Object} val The value to test
|
178
|
+
* @returns {boolean} True if value is a File, otherwise false
|
179
|
+
*/
|
180
|
+
var isFileList = kindOfTest('FileList');
|
181
|
+
|
182
|
+
/**
|
183
|
+
* Determine if a value is a Function
|
184
|
+
*
|
185
|
+
* @param {Object} val The value to test
|
186
|
+
* @returns {boolean} True if value is a Function, otherwise false
|
187
|
+
*/
|
188
|
+
function isFunction(val) {
|
189
|
+
return toString.call(val) === '[object Function]';
|
190
|
+
}
|
191
|
+
|
192
|
+
/**
|
193
|
+
* Determine if a value is a Stream
|
194
|
+
*
|
195
|
+
* @param {Object} val The value to test
|
196
|
+
* @returns {boolean} True if value is a Stream, otherwise false
|
197
|
+
*/
|
198
|
+
function isStream(val) {
|
199
|
+
return isObject(val) && isFunction(val.pipe);
|
200
|
+
}
|
201
|
+
|
202
|
+
/**
|
203
|
+
* Determine if a value is a FormData
|
204
|
+
*
|
205
|
+
* @param {Object} thing The value to test
|
206
|
+
* @returns {boolean} True if value is an FormData, otherwise false
|
207
|
+
*/
|
208
|
+
function isFormData(thing) {
|
209
|
+
var pattern = '[object FormData]';
|
210
|
+
return thing && (
|
211
|
+
(typeof FormData === 'function' && thing instanceof FormData) ||
|
212
|
+
toString.call(thing) === pattern ||
|
213
|
+
(isFunction(thing.toString) && thing.toString() === pattern)
|
214
|
+
);
|
215
|
+
}
|
171
216
|
|
172
|
-
|
217
|
+
/**
|
218
|
+
* Determine if a value is a URLSearchParams object
|
219
|
+
* @function
|
220
|
+
* @param {Object} val The value to test
|
221
|
+
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
222
|
+
*/
|
223
|
+
var isURLSearchParams = kindOfTest('URLSearchParams');
|
173
224
|
|
174
|
-
|
175
|
-
|
225
|
+
/**
|
226
|
+
* Trim excess whitespace off the beginning and end of a string
|
227
|
+
*
|
228
|
+
* @param {String} str The String to trim
|
229
|
+
* @returns {String} The String freed of excess whitespace
|
230
|
+
*/
|
231
|
+
function trim(str) {
|
232
|
+
return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
233
|
+
}
|
234
|
+
|
235
|
+
/**
|
236
|
+
* Determine if we're running in a standard browser environment
|
237
|
+
*
|
238
|
+
* This allows axios to run in a web worker, and react-native.
|
239
|
+
* Both environments support XMLHttpRequest, but not fully standard globals.
|
240
|
+
*
|
241
|
+
* web workers:
|
242
|
+
* typeof window -> undefined
|
243
|
+
* typeof document -> undefined
|
244
|
+
*
|
245
|
+
* react-native:
|
246
|
+
* navigator.product -> 'ReactNative'
|
247
|
+
* nativescript
|
248
|
+
* navigator.product -> 'NativeScript' or 'NS'
|
249
|
+
*/
|
250
|
+
function isStandardBrowserEnv() {
|
251
|
+
var product;
|
252
|
+
if (typeof navigator !== 'undefined' && (
|
253
|
+
(product = navigator.product) === 'ReactNative' ||
|
254
|
+
product === 'NativeScript' ||
|
255
|
+
product === 'NS')
|
256
|
+
) {
|
257
|
+
return false;
|
258
|
+
}
|
259
|
+
|
260
|
+
return typeof window !== 'undefined' && typeof document !== 'undefined';
|
261
|
+
}
|
262
|
+
|
263
|
+
/**
|
264
|
+
* Iterate over an Array or an Object invoking a function for each item.
|
265
|
+
*
|
266
|
+
* If `obj` is an Array callback will be called passing
|
267
|
+
* the value, index, and complete array for each item.
|
268
|
+
*
|
269
|
+
* If 'obj' is an Object callback will be called passing
|
270
|
+
* the value, key, and complete object for each property.
|
271
|
+
*
|
272
|
+
* @param {Object|Array} obj The object to iterate
|
273
|
+
* @param {Function} fn The callback to invoke for each item
|
274
|
+
*/
|
275
|
+
function forEach(obj, fn) {
|
276
|
+
// Don't bother if no value provided
|
277
|
+
if (obj === null || typeof obj === 'undefined') {
|
278
|
+
return;
|
176
279
|
}
|
177
280
|
|
178
|
-
if
|
179
|
-
|
180
|
-
|
281
|
+
// Force an array if not already something iterable
|
282
|
+
if (typeof obj !== 'object') {
|
283
|
+
/*eslint no-param-reassign:0*/
|
284
|
+
obj = [obj];
|
285
|
+
}
|
286
|
+
|
287
|
+
if (isArray(obj)) {
|
288
|
+
// Iterate over array values
|
289
|
+
for (var i = 0, l = obj.length; i < l; i++) {
|
290
|
+
fn.call(null, obj[i], i, obj);
|
291
|
+
}
|
181
292
|
} else {
|
182
|
-
//
|
183
|
-
|
184
|
-
if (
|
185
|
-
|
293
|
+
// Iterate over object keys
|
294
|
+
for (var key in obj) {
|
295
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
296
|
+
fn.call(null, obj[key], key, obj);
|
186
297
|
}
|
298
|
+
}
|
299
|
+
}
|
300
|
+
}
|
187
301
|
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
302
|
+
/**
|
303
|
+
* Accepts varargs expecting each argument to be an object, then
|
304
|
+
* immutably merges the properties of each object and returns result.
|
305
|
+
*
|
306
|
+
* When multiple objects contain the same key the later object in
|
307
|
+
* the arguments list will take precedence.
|
308
|
+
*
|
309
|
+
* Example:
|
310
|
+
*
|
311
|
+
* ```js
|
312
|
+
* var result = merge({foo: 123}, {foo: 456});
|
313
|
+
* console.log(result.foo); // outputs 456
|
314
|
+
* ```
|
315
|
+
*
|
316
|
+
* @param {Object} obj1 Object to merge
|
317
|
+
* @returns {Object} Result of all merge properties
|
318
|
+
*/
|
319
|
+
function merge(/* obj1, obj2, obj3, ... */) {
|
320
|
+
var result = {};
|
321
|
+
function assignValue(val, key) {
|
322
|
+
if (isPlainObject(result[key]) && isPlainObject(val)) {
|
323
|
+
result[key] = merge(result[key], val);
|
324
|
+
} else if (isPlainObject(val)) {
|
325
|
+
result[key] = merge({}, val);
|
326
|
+
} else if (isArray(val)) {
|
327
|
+
result[key] = val.slice();
|
328
|
+
} else {
|
329
|
+
result[key] = val;
|
330
|
+
}
|
199
331
|
}
|
200
332
|
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
333
|
+
for (var i = 0, l = arguments.length; i < l; i++) {
|
334
|
+
forEach(arguments[i], assignValue);
|
335
|
+
}
|
336
|
+
return result;
|
337
|
+
}
|
338
|
+
|
339
|
+
/**
|
340
|
+
* Extends object a by mutably adding to it the properties of object b.
|
341
|
+
*
|
342
|
+
* @param {Object} a The object to be extended
|
343
|
+
* @param {Object} b The object to copy properties from
|
344
|
+
* @param {Object} thisArg The object to bind function to
|
345
|
+
* @return {Object} The resulting value of object a
|
346
|
+
*/
|
347
|
+
function extend(a, b, thisArg) {
|
348
|
+
forEach(b, function assignValue(val, key) {
|
349
|
+
if (thisArg && typeof val === 'function') {
|
350
|
+
a[key] = bind(val, thisArg);
|
351
|
+
} else {
|
352
|
+
a[key] = val;
|
205
353
|
}
|
354
|
+
});
|
355
|
+
return a;
|
356
|
+
}
|
206
357
|
|
207
|
-
|
358
|
+
/**
|
359
|
+
* Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
|
360
|
+
*
|
361
|
+
* @param {string} content with BOM
|
362
|
+
* @return {string} content value without BOM
|
363
|
+
*/
|
364
|
+
function stripBOM(content) {
|
365
|
+
if (content.charCodeAt(0) === 0xFEFF) {
|
366
|
+
content = content.slice(1);
|
367
|
+
}
|
368
|
+
return content;
|
369
|
+
}
|
208
370
|
|
209
|
-
|
210
|
-
|
211
|
-
|
371
|
+
/**
|
372
|
+
* Inherit the prototype methods from one constructor into another
|
373
|
+
* @param {function} constructor
|
374
|
+
* @param {function} superConstructor
|
375
|
+
* @param {object} [props]
|
376
|
+
* @param {object} [descriptors]
|
377
|
+
*/
|
212
378
|
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
379
|
+
function inherits(constructor, superConstructor, props, descriptors) {
|
380
|
+
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
381
|
+
constructor.prototype.constructor = constructor;
|
382
|
+
props && Object.assign(constructor.prototype, props);
|
383
|
+
}
|
218
384
|
|
219
|
-
|
220
|
-
|
221
|
-
|
385
|
+
/**
|
386
|
+
* Resolve object with deep prototype chain to a flat object
|
387
|
+
* @param {Object} sourceObj source object
|
388
|
+
* @param {Object} [destObj]
|
389
|
+
* @param {Function|Boolean} [filter]
|
390
|
+
* @param {Function} [propFilter]
|
391
|
+
* @returns {Object}
|
392
|
+
*/
|
222
393
|
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
394
|
+
function toFlatObject(sourceObj, destObj, filter, propFilter) {
|
395
|
+
var props;
|
396
|
+
var i;
|
397
|
+
var prop;
|
398
|
+
var merged = {};
|
399
|
+
|
400
|
+
destObj = destObj || {};
|
401
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
402
|
+
if (sourceObj == null) return destObj;
|
403
|
+
|
404
|
+
do {
|
405
|
+
props = Object.getOwnPropertyNames(sourceObj);
|
406
|
+
i = props.length;
|
407
|
+
while (i-- > 0) {
|
408
|
+
prop = props[i];
|
409
|
+
if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
|
410
|
+
destObj[prop] = sourceObj[prop];
|
411
|
+
merged[prop] = true;
|
412
|
+
}
|
228
413
|
}
|
229
|
-
|
230
|
-
|
231
|
-
config,
|
232
|
-
config.transitional && config.transitional.clarifyTimeoutError ? 'ETIMEDOUT' : 'ECONNABORTED',
|
233
|
-
request));
|
234
|
-
|
235
|
-
// Clean up request
|
236
|
-
request = null;
|
237
|
-
};
|
414
|
+
sourceObj = filter !== false && Object.getPrototypeOf(sourceObj);
|
415
|
+
} while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
238
416
|
|
239
|
-
|
240
|
-
|
241
|
-
// Specifically not if we're in a web worker, or react-native.
|
242
|
-
if (utils.isStandardBrowserEnv()) {
|
243
|
-
// Add xsrf header
|
244
|
-
var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
|
245
|
-
cookies.read(config.xsrfCookieName) :
|
246
|
-
undefined;
|
417
|
+
return destObj;
|
418
|
+
}
|
247
419
|
|
248
|
-
|
249
|
-
|
250
|
-
|
420
|
+
/*
|
421
|
+
* determines whether a string ends with the characters of a specified string
|
422
|
+
* @param {String} str
|
423
|
+
* @param {String} searchString
|
424
|
+
* @param {Number} [position= 0]
|
425
|
+
* @returns {boolean}
|
426
|
+
*/
|
427
|
+
function endsWith(str, searchString, position) {
|
428
|
+
str = String(str);
|
429
|
+
if (position === undefined || position > str.length) {
|
430
|
+
position = str.length;
|
251
431
|
}
|
432
|
+
position -= searchString.length;
|
433
|
+
var lastIndex = str.indexOf(searchString, position);
|
434
|
+
return lastIndex !== -1 && lastIndex === position;
|
435
|
+
}
|
252
436
|
|
253
|
-
// Add headers to the request
|
254
|
-
if ('setRequestHeader' in request) {
|
255
|
-
utils.forEach(requestHeaders, function setRequestHeader(val, key) {
|
256
|
-
if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
|
257
|
-
// Remove Content-Type if data is undefined
|
258
|
-
delete requestHeaders[key];
|
259
|
-
} else {
|
260
|
-
// Otherwise add header to the request
|
261
|
-
request.setRequestHeader(key, val);
|
262
|
-
}
|
263
|
-
});
|
264
|
-
}
|
265
437
|
|
266
|
-
|
267
|
-
|
268
|
-
|
438
|
+
/**
|
439
|
+
* Returns new array from array like object or null if failed
|
440
|
+
* @param {*} [thing]
|
441
|
+
* @returns {?Array}
|
442
|
+
*/
|
443
|
+
function toArray(thing) {
|
444
|
+
if (!thing) return null;
|
445
|
+
if (isArray(thing)) return thing;
|
446
|
+
var i = thing.length;
|
447
|
+
if (!isNumber(i)) return null;
|
448
|
+
var arr = new Array(i);
|
449
|
+
while (i-- > 0) {
|
450
|
+
arr[i] = thing[i];
|
269
451
|
}
|
452
|
+
return arr;
|
453
|
+
}
|
270
454
|
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
455
|
+
// eslint-disable-next-line func-names
|
456
|
+
var isTypedArray = (function(TypedArray) {
|
457
|
+
// eslint-disable-next-line func-names
|
458
|
+
return function(thing) {
|
459
|
+
return TypedArray && thing instanceof TypedArray;
|
460
|
+
};
|
461
|
+
})(typeof Uint8Array !== 'undefined' && Object.getPrototypeOf(Uint8Array));
|
462
|
+
|
463
|
+
function forEachEntry(obj, fn) {
|
464
|
+
var generator = obj && obj[Symbol.iterator];
|
465
|
+
|
466
|
+
var iterator = generator.call(obj);
|
467
|
+
|
468
|
+
var result;
|
275
469
|
|
276
|
-
|
277
|
-
|
278
|
-
|
470
|
+
while ((result = iterator.next()) && !result.done) {
|
471
|
+
var pair = result.value;
|
472
|
+
fn.call(obj, pair[0], pair[1]);
|
279
473
|
}
|
474
|
+
}
|
475
|
+
|
476
|
+
function matchAll(regExp, str) {
|
477
|
+
var matches;
|
478
|
+
var arr = [];
|
280
479
|
|
281
|
-
|
282
|
-
|
283
|
-
request.upload.addEventListener('progress', config.onUploadProgress);
|
480
|
+
while ((matches = regExp.exec(str)) !== null) {
|
481
|
+
arr.push(matches);
|
284
482
|
}
|
285
483
|
|
286
|
-
|
287
|
-
|
288
|
-
config.cancelToken.promise.then(function onCanceled(cancel) {
|
289
|
-
if (!request) {
|
290
|
-
return;
|
291
|
-
}
|
484
|
+
return arr;
|
485
|
+
}
|
292
486
|
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
487
|
+
var isHTMLForm = kindOfTest('HTMLFormElement');
|
488
|
+
|
489
|
+
var hasOwnProperty = (function resolver(_hasOwnProperty) {
|
490
|
+
return function(obj, prop) {
|
491
|
+
return _hasOwnProperty.call(obj, prop);
|
492
|
+
};
|
493
|
+
})(Object.prototype.hasOwnProperty);
|
494
|
+
|
495
|
+
var utils = {
|
496
|
+
isArray: isArray,
|
497
|
+
isArrayBuffer: isArrayBuffer,
|
498
|
+
isBuffer: isBuffer,
|
499
|
+
isFormData: isFormData,
|
500
|
+
isArrayBufferView: isArrayBufferView,
|
501
|
+
isString: isString,
|
502
|
+
isNumber: isNumber,
|
503
|
+
isObject: isObject,
|
504
|
+
isPlainObject: isPlainObject,
|
505
|
+
isEmptyObject: isEmptyObject,
|
506
|
+
isUndefined: isUndefined,
|
507
|
+
isDate: isDate,
|
508
|
+
isFile: isFile,
|
509
|
+
isBlob: isBlob,
|
510
|
+
isFunction: isFunction,
|
511
|
+
isStream: isStream,
|
512
|
+
isURLSearchParams: isURLSearchParams,
|
513
|
+
isStandardBrowserEnv: isStandardBrowserEnv,
|
514
|
+
forEach: forEach,
|
515
|
+
merge: merge,
|
516
|
+
extend: extend,
|
517
|
+
trim: trim,
|
518
|
+
stripBOM: stripBOM,
|
519
|
+
inherits: inherits,
|
520
|
+
toFlatObject: toFlatObject,
|
521
|
+
kindOf: kindOf,
|
522
|
+
kindOfTest: kindOfTest,
|
523
|
+
endsWith: endsWith,
|
524
|
+
toArray: toArray,
|
525
|
+
isTypedArray: isTypedArray,
|
526
|
+
isFileList: isFileList,
|
527
|
+
forEachEntry: forEachEntry,
|
528
|
+
matchAll: matchAll,
|
529
|
+
isHTMLForm: isHTMLForm,
|
530
|
+
hasOwnProperty: hasOwnProperty
|
531
|
+
};
|
532
|
+
|
533
|
+
/**
|
534
|
+
* Create an Error with the specified message, config, error code, request and response.
|
535
|
+
*
|
536
|
+
* @param {string} message The error message.
|
537
|
+
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
538
|
+
* @param {Object} [config] The config.
|
539
|
+
* @param {Object} [request] The request.
|
540
|
+
* @param {Object} [response] The response.
|
541
|
+
* @returns {Error} The created error.
|
542
|
+
*/
|
543
|
+
function AxiosError(message, code, config, request, response) {
|
544
|
+
Error.call(this);
|
545
|
+
|
546
|
+
if (Error.captureStackTrace) {
|
547
|
+
Error.captureStackTrace(this, this.constructor);
|
548
|
+
} else {
|
549
|
+
this.stack = (new Error()).stack;
|
298
550
|
}
|
299
551
|
|
300
|
-
|
301
|
-
|
552
|
+
this.message = message;
|
553
|
+
this.name = 'AxiosError';
|
554
|
+
code && (this.code = code);
|
555
|
+
config && (this.config = config);
|
556
|
+
request && (this.request = request);
|
557
|
+
response && (this.response = response);
|
558
|
+
}
|
559
|
+
|
560
|
+
utils.inherits(AxiosError, Error, {
|
561
|
+
toJSON: function toJSON() {
|
562
|
+
return {
|
563
|
+
// Standard
|
564
|
+
message: this.message,
|
565
|
+
name: this.name,
|
566
|
+
// Microsoft
|
567
|
+
description: this.description,
|
568
|
+
number: this.number,
|
569
|
+
// Mozilla
|
570
|
+
fileName: this.fileName,
|
571
|
+
lineNumber: this.lineNumber,
|
572
|
+
columnNumber: this.columnNumber,
|
573
|
+
stack: this.stack,
|
574
|
+
// Axios
|
575
|
+
config: this.config,
|
576
|
+
code: this.code,
|
577
|
+
status: this.response && this.response.status ? this.response.status : null
|
578
|
+
};
|
302
579
|
}
|
580
|
+
});
|
303
581
|
|
304
|
-
|
305
|
-
|
582
|
+
var prototype$1 = AxiosError.prototype;
|
583
|
+
var descriptors = {};
|
584
|
+
|
585
|
+
[
|
586
|
+
'ERR_BAD_OPTION_VALUE',
|
587
|
+
'ERR_BAD_OPTION',
|
588
|
+
'ECONNABORTED',
|
589
|
+
'ETIMEDOUT',
|
590
|
+
'ERR_NETWORK',
|
591
|
+
'ERR_FR_TOO_MANY_REDIRECTS',
|
592
|
+
'ERR_DEPRECATED',
|
593
|
+
'ERR_BAD_RESPONSE',
|
594
|
+
'ERR_BAD_REQUEST',
|
595
|
+
'ERR_CANCELED',
|
596
|
+
'ERR_NOT_SUPPORT',
|
597
|
+
'ERR_INVALID_URL'
|
598
|
+
// eslint-disable-next-line func-names
|
599
|
+
].forEach(function(code) {
|
600
|
+
descriptors[code] = {value: code};
|
306
601
|
});
|
307
|
-
};
|
308
602
|
|
603
|
+
Object.defineProperties(AxiosError, descriptors);
|
604
|
+
Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
|
309
605
|
|
310
|
-
|
606
|
+
// eslint-disable-next-line func-names
|
607
|
+
AxiosError.from = function(error, code, config, request, response, customProps) {
|
608
|
+
var axiosError = Object.create(prototype$1);
|
311
609
|
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
\**********************/
|
316
|
-
/*! no static exports found */
|
317
|
-
/***/ (function(module, exports, __webpack_require__) {
|
610
|
+
utils.toFlatObject(error, axiosError, function filter(obj) {
|
611
|
+
return obj !== Error.prototype;
|
612
|
+
});
|
318
613
|
|
319
|
-
|
614
|
+
AxiosError.call(axiosError, error.message, code, config, request, response);
|
320
615
|
|
616
|
+
axiosError.cause = error;
|
321
617
|
|
322
|
-
|
323
|
-
var bind = __webpack_require__(/*! ./helpers/bind */ "./lib/helpers/bind.js");
|
324
|
-
var Axios = __webpack_require__(/*! ./core/Axios */ "./lib/core/Axios.js");
|
325
|
-
var mergeConfig = __webpack_require__(/*! ./core/mergeConfig */ "./lib/core/mergeConfig.js");
|
326
|
-
var defaults = __webpack_require__(/*! ./defaults */ "./lib/defaults.js");
|
618
|
+
axiosError.name = error.name;
|
327
619
|
|
328
|
-
|
329
|
-
* Create an instance of Axios
|
330
|
-
*
|
331
|
-
* @param {Object} defaultConfig The default config for the instance
|
332
|
-
* @return {Axios} A new instance of Axios
|
333
|
-
*/
|
334
|
-
function createInstance(defaultConfig) {
|
335
|
-
var context = new Axios(defaultConfig);
|
336
|
-
var instance = bind(Axios.prototype.request, context);
|
620
|
+
customProps && Object.assign(axiosError, customProps);
|
337
621
|
|
338
|
-
|
339
|
-
|
622
|
+
return axiosError;
|
623
|
+
};
|
340
624
|
|
341
|
-
|
342
|
-
utils.extend(instance, context);
|
625
|
+
var AxiosError_1 = AxiosError;
|
343
626
|
|
344
|
-
|
345
|
-
|
627
|
+
/* eslint-env browser */
|
628
|
+
var browser$1 = typeof self == 'object' ? self.FormData : window.FormData;
|
346
629
|
|
347
|
-
//
|
348
|
-
var
|
630
|
+
// eslint-disable-next-line strict
|
631
|
+
var FormData$1 = browser$1;
|
349
632
|
|
350
|
-
|
351
|
-
|
633
|
+
function isVisitable(thing) {
|
634
|
+
return utils.isPlainObject(thing) || utils.isArray(thing);
|
635
|
+
}
|
352
636
|
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
};
|
637
|
+
function removeBrackets(key) {
|
638
|
+
return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
|
639
|
+
}
|
357
640
|
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
641
|
+
function renderKey(path, key, dots) {
|
642
|
+
if (!path) return key;
|
643
|
+
return path.concat(key).map(function each(token, i) {
|
644
|
+
// eslint-disable-next-line no-param-reassign
|
645
|
+
token = removeBrackets(token);
|
646
|
+
return !dots && i ? '[' + token + ']' : token;
|
647
|
+
}).join(dots ? '.' : '');
|
648
|
+
}
|
362
649
|
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
};
|
367
|
-
axios.spread = __webpack_require__(/*! ./helpers/spread */ "./lib/helpers/spread.js");
|
650
|
+
function isFlatArray(arr) {
|
651
|
+
return utils.isArray(arr) && !arr.some(isVisitable);
|
652
|
+
}
|
368
653
|
|
369
|
-
|
370
|
-
|
654
|
+
var predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
|
655
|
+
return /^is[A-Z]/.test(prop);
|
656
|
+
});
|
371
657
|
|
372
|
-
|
658
|
+
function isSpecCompliant(thing) {
|
659
|
+
return thing && utils.isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator];
|
660
|
+
}
|
373
661
|
|
374
|
-
|
375
|
-
|
662
|
+
/**
|
663
|
+
* Convert a data object to FormData
|
664
|
+
* @param {Object} obj
|
665
|
+
* @param {?Object} [formData]
|
666
|
+
* @param {?Object} [options]
|
667
|
+
* @param {Function} [options.visitor]
|
668
|
+
* @param {Boolean} [options.metaTokens = true]
|
669
|
+
* @param {Boolean} [options.dots = false]
|
670
|
+
* @param {?Boolean} [options.indexes = false]
|
671
|
+
* @returns {Object}
|
672
|
+
**/
|
673
|
+
|
674
|
+
function toFormData(obj, formData, options) {
|
675
|
+
if (!utils.isObject(obj)) {
|
676
|
+
throw new TypeError('target must be an object');
|
677
|
+
}
|
376
678
|
|
679
|
+
// eslint-disable-next-line no-param-reassign
|
680
|
+
formData = formData || new (FormData$1 || FormData)();
|
681
|
+
|
682
|
+
// eslint-disable-next-line no-param-reassign
|
683
|
+
options = utils.toFlatObject(options, {
|
684
|
+
metaTokens: true,
|
685
|
+
dots: false,
|
686
|
+
indexes: false
|
687
|
+
}, false, function defined(option, source) {
|
688
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
689
|
+
return !utils.isUndefined(source[option]);
|
690
|
+
});
|
377
691
|
|
378
|
-
|
692
|
+
var metaTokens = options.metaTokens;
|
693
|
+
// eslint-disable-next-line no-use-before-define
|
694
|
+
var visitor = options.visitor || defaultVisitor;
|
695
|
+
var dots = options.dots;
|
696
|
+
var indexes = options.indexes;
|
697
|
+
var _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
|
698
|
+
var useBlob = _Blob && isSpecCompliant(formData);
|
379
699
|
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
\******************************/
|
384
|
-
/*! no static exports found */
|
385
|
-
/***/ (function(module, exports, __webpack_require__) {
|
700
|
+
if (!utils.isFunction(visitor)) {
|
701
|
+
throw new TypeError('visitor must be a function');
|
702
|
+
}
|
386
703
|
|
387
|
-
|
704
|
+
function convertValue(value) {
|
705
|
+
if (value === null) return '';
|
706
|
+
|
707
|
+
if (utils.isDate(value)) {
|
708
|
+
return value.toISOString();
|
709
|
+
}
|
710
|
+
|
711
|
+
if (!useBlob && utils.isBlob(value)) {
|
712
|
+
throw new AxiosError_1('Blob is not supported. Use a Buffer instead.');
|
713
|
+
}
|
714
|
+
|
715
|
+
if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
|
716
|
+
return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
|
717
|
+
}
|
388
718
|
|
719
|
+
return value;
|
720
|
+
}
|
389
721
|
|
390
|
-
/**
|
391
|
-
|
392
|
-
*
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
722
|
+
/**
|
723
|
+
*
|
724
|
+
* @param {*} value
|
725
|
+
* @param {String|Number} key
|
726
|
+
* @param {Array<String|Number>} path
|
727
|
+
* @this {FormData}
|
728
|
+
* @returns {boolean} return true to visit the each prop of the value recursively
|
729
|
+
*/
|
730
|
+
function defaultVisitor(value, key, path) {
|
731
|
+
var arr = value;
|
732
|
+
|
733
|
+
if (value && !path && typeof value === 'object') {
|
734
|
+
if (utils.endsWith(key, '{}')) {
|
735
|
+
// eslint-disable-next-line no-param-reassign
|
736
|
+
key = metaTokens ? key : key.slice(0, -2);
|
737
|
+
// eslint-disable-next-line no-param-reassign
|
738
|
+
value = JSON.stringify(value);
|
739
|
+
} else if (
|
740
|
+
(utils.isArray(value) && isFlatArray(value)) ||
|
741
|
+
(utils.isFileList(value) || utils.endsWith(key, '[]') && (arr = utils.toArray(value))
|
742
|
+
)) {
|
743
|
+
// eslint-disable-next-line no-param-reassign
|
744
|
+
key = removeBrackets(key);
|
745
|
+
|
746
|
+
arr.forEach(function each(el, index) {
|
747
|
+
!(utils.isUndefined(el) || el === null) && formData.append(
|
748
|
+
// eslint-disable-next-line no-nested-ternary
|
749
|
+
indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
|
750
|
+
convertValue(el)
|
751
|
+
);
|
752
|
+
});
|
753
|
+
return false;
|
754
|
+
}
|
755
|
+
}
|
399
756
|
|
400
|
-
|
401
|
-
|
402
|
-
}
|
757
|
+
if (isVisitable(value)) {
|
758
|
+
return true;
|
759
|
+
}
|
403
760
|
|
404
|
-
|
761
|
+
formData.append(renderKey(path, key, dots), convertValue(value));
|
405
762
|
|
406
|
-
|
763
|
+
return false;
|
764
|
+
}
|
407
765
|
|
766
|
+
var stack = [];
|
408
767
|
|
409
|
-
|
768
|
+
var exposedHelpers = Object.assign(predicates, {
|
769
|
+
defaultVisitor: defaultVisitor,
|
770
|
+
convertValue: convertValue,
|
771
|
+
isVisitable: isVisitable
|
772
|
+
});
|
410
773
|
|
411
|
-
|
412
|
-
|
413
|
-
!*** ./lib/cancel/CancelToken.js ***!
|
414
|
-
\***********************************/
|
415
|
-
/*! no static exports found */
|
416
|
-
/***/ (function(module, exports, __webpack_require__) {
|
774
|
+
function build(value, path) {
|
775
|
+
if (utils.isUndefined(value)) return;
|
417
776
|
|
418
|
-
|
777
|
+
if (stack.indexOf(value) !== -1) {
|
778
|
+
throw Error('Circular reference detected in ' + path.join('.'));
|
779
|
+
}
|
419
780
|
|
781
|
+
stack.push(value);
|
420
782
|
|
421
|
-
|
783
|
+
utils.forEach(value, function each(el, key) {
|
784
|
+
var result = !(utils.isUndefined(el) || el === null) && visitor.call(
|
785
|
+
formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
|
786
|
+
);
|
422
787
|
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
* @param {Function} executor The executor function.
|
428
|
-
*/
|
429
|
-
function CancelToken(executor) {
|
430
|
-
if (typeof executor !== 'function') {
|
431
|
-
throw new TypeError('executor must be a function.');
|
432
|
-
}
|
788
|
+
if (result === true) {
|
789
|
+
build(el, path ? path.concat(key) : [key]);
|
790
|
+
}
|
791
|
+
});
|
433
792
|
|
434
|
-
|
435
|
-
|
436
|
-
resolvePromise = resolve;
|
437
|
-
});
|
793
|
+
stack.pop();
|
794
|
+
}
|
438
795
|
|
439
|
-
|
440
|
-
|
441
|
-
if (token.reason) {
|
442
|
-
// Cancellation has already been requested
|
443
|
-
return;
|
796
|
+
if (!utils.isObject(obj)) {
|
797
|
+
throw new TypeError('data must be an object');
|
444
798
|
}
|
445
799
|
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
}
|
450
|
-
|
451
|
-
/**
|
452
|
-
* Throws a `Cancel` if cancellation has been requested.
|
453
|
-
*/
|
454
|
-
CancelToken.prototype.throwIfRequested = function throwIfRequested() {
|
455
|
-
if (this.reason) {
|
456
|
-
throw this.reason;
|
800
|
+
build(obj);
|
801
|
+
|
802
|
+
return formData;
|
457
803
|
}
|
458
|
-
};
|
459
|
-
|
460
|
-
/**
|
461
|
-
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
462
|
-
* cancels the `CancelToken`.
|
463
|
-
*/
|
464
|
-
CancelToken.source = function source() {
|
465
|
-
var cancel;
|
466
|
-
var token = new CancelToken(function executor(c) {
|
467
|
-
cancel = c;
|
468
|
-
});
|
469
|
-
return {
|
470
|
-
token: token,
|
471
|
-
cancel: cancel
|
472
|
-
};
|
473
|
-
};
|
474
804
|
|
475
|
-
|
805
|
+
var toFormData_1 = toFormData;
|
806
|
+
|
807
|
+
function encode$1(str) {
|
808
|
+
var charMap = {
|
809
|
+
'!': '%21',
|
810
|
+
"'": '%27',
|
811
|
+
'(': '%28',
|
812
|
+
')': '%29',
|
813
|
+
'~': '%7E',
|
814
|
+
'%20': '+',
|
815
|
+
'%00': '\x00'
|
816
|
+
};
|
817
|
+
return encodeURIComponent(str).replace(/[!'\(\)~]|%20|%00/g, function replacer(match) {
|
818
|
+
return charMap[match];
|
819
|
+
});
|
820
|
+
}
|
476
821
|
|
822
|
+
function AxiosURLSearchParams(params, options) {
|
823
|
+
this._pairs = [];
|
477
824
|
|
478
|
-
|
825
|
+
params && toFormData_1(params, this, options);
|
826
|
+
}
|
479
827
|
|
480
|
-
|
481
|
-
/*!********************************!*\
|
482
|
-
!*** ./lib/cancel/isCancel.js ***!
|
483
|
-
\********************************/
|
484
|
-
/*! no static exports found */
|
485
|
-
/***/ (function(module, exports, __webpack_require__) {
|
828
|
+
var prototype = AxiosURLSearchParams.prototype;
|
486
829
|
|
487
|
-
|
830
|
+
prototype.append = function append(name, value) {
|
831
|
+
this._pairs.push([name, value]);
|
832
|
+
};
|
488
833
|
|
834
|
+
prototype.toString = function toString(encoder) {
|
835
|
+
var _encode = encoder ? function(value) {
|
836
|
+
return encoder.call(this, value, encode$1);
|
837
|
+
} : encode$1;
|
489
838
|
|
490
|
-
|
491
|
-
|
492
|
-
};
|
839
|
+
return this._pairs.map(function each(pair) {
|
840
|
+
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
841
|
+
}, '').join('&');
|
842
|
+
};
|
493
843
|
|
844
|
+
var AxiosURLSearchParams_1 = AxiosURLSearchParams;
|
494
845
|
|
495
|
-
|
846
|
+
function encode(val) {
|
847
|
+
return encodeURIComponent(val).
|
848
|
+
replace(/%3A/gi, ':').
|
849
|
+
replace(/%24/g, '$').
|
850
|
+
replace(/%2C/gi, ',').
|
851
|
+
replace(/%20/g, '+').
|
852
|
+
replace(/%5B/gi, '[').
|
853
|
+
replace(/%5D/gi, ']');
|
854
|
+
}
|
496
855
|
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
856
|
+
/**
|
857
|
+
* Build a URL by appending params to the end
|
858
|
+
*
|
859
|
+
* @param {string} url The base of the url (e.g., http://www.google.com)
|
860
|
+
* @param {object} [params] The params to be appended
|
861
|
+
* @param {?object} options
|
862
|
+
* @returns {string} The formatted url
|
863
|
+
*/
|
864
|
+
var buildURL = function buildURL(url, params, options) {
|
865
|
+
/*eslint no-param-reassign:0*/
|
866
|
+
if (!params) {
|
867
|
+
return url;
|
868
|
+
}
|
869
|
+
|
870
|
+
var hashmarkIndex = url.indexOf('#');
|
871
|
+
|
872
|
+
if (hashmarkIndex !== -1) {
|
873
|
+
url = url.slice(0, hashmarkIndex);
|
874
|
+
}
|
875
|
+
|
876
|
+
var _encode = options && options.encode || encode;
|
503
877
|
|
504
|
-
|
878
|
+
var serializeFn = options && options.serialize;
|
505
879
|
|
880
|
+
var serializedParams;
|
881
|
+
|
882
|
+
if (serializeFn) {
|
883
|
+
serializedParams = serializeFn(params, options);
|
884
|
+
} else {
|
885
|
+
serializedParams = utils.isURLSearchParams(params) ?
|
886
|
+
params.toString() :
|
887
|
+
new AxiosURLSearchParams_1(params, options).toString(_encode);
|
888
|
+
}
|
506
889
|
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "./lib/core/dispatchRequest.js");
|
511
|
-
var mergeConfig = __webpack_require__(/*! ./mergeConfig */ "./lib/core/mergeConfig.js");
|
512
|
-
var validator = __webpack_require__(/*! ../helpers/validator */ "./lib/helpers/validator.js");
|
890
|
+
if (serializedParams) {
|
891
|
+
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
|
892
|
+
}
|
513
893
|
|
514
|
-
|
515
|
-
/**
|
516
|
-
* Create a new instance of Axios
|
517
|
-
*
|
518
|
-
* @param {Object} instanceConfig The default config for the instance
|
519
|
-
*/
|
520
|
-
function Axios(instanceConfig) {
|
521
|
-
this.defaults = instanceConfig;
|
522
|
-
this.interceptors = {
|
523
|
-
request: new InterceptorManager(),
|
524
|
-
response: new InterceptorManager()
|
894
|
+
return url;
|
525
895
|
};
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
* Dispatch a request
|
530
|
-
*
|
531
|
-
* @param {Object} config The config specific for this request (merged with this.defaults)
|
532
|
-
*/
|
533
|
-
Axios.prototype.request = function request(config) {
|
534
|
-
/*eslint no-param-reassign:0*/
|
535
|
-
// Allow for axios('example/url'[, config]) a la fetch API
|
536
|
-
if (typeof config === 'string') {
|
537
|
-
config = arguments[1] || {};
|
538
|
-
config.url = arguments[0];
|
539
|
-
} else {
|
540
|
-
config = config || {};
|
896
|
+
|
897
|
+
function InterceptorManager() {
|
898
|
+
this.handlers = [];
|
541
899
|
}
|
542
900
|
|
543
|
-
|
901
|
+
/**
|
902
|
+
* Add a new interceptor to the stack
|
903
|
+
*
|
904
|
+
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
905
|
+
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
906
|
+
*
|
907
|
+
* @return {Number} An ID used to remove interceptor later
|
908
|
+
*/
|
909
|
+
InterceptorManager.prototype.use = function use(fulfilled, rejected, options) {
|
910
|
+
this.handlers.push({
|
911
|
+
fulfilled: fulfilled,
|
912
|
+
rejected: rejected,
|
913
|
+
synchronous: options ? options.synchronous : false,
|
914
|
+
runWhen: options ? options.runWhen : null
|
915
|
+
});
|
916
|
+
return this.handlers.length - 1;
|
917
|
+
};
|
544
918
|
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
919
|
+
/**
|
920
|
+
* Remove an interceptor from the stack
|
921
|
+
*
|
922
|
+
* @param {Number} id The ID that was returned by `use`
|
923
|
+
*/
|
924
|
+
InterceptorManager.prototype.eject = function eject(id) {
|
925
|
+
if (this.handlers[id]) {
|
926
|
+
this.handlers[id] = null;
|
927
|
+
}
|
928
|
+
};
|
553
929
|
|
554
|
-
|
930
|
+
/**
|
931
|
+
* Clear all interceptors from the stack
|
932
|
+
*/
|
933
|
+
InterceptorManager.prototype.clear = function clear() {
|
934
|
+
if (this.handlers) {
|
935
|
+
this.handlers = [];
|
936
|
+
}
|
937
|
+
};
|
938
|
+
|
939
|
+
/**
|
940
|
+
* Iterate over all the registered interceptors
|
941
|
+
*
|
942
|
+
* This method is particularly useful for skipping over any
|
943
|
+
* interceptors that may have become `null` calling `eject`.
|
944
|
+
*
|
945
|
+
* @param {Function} fn The function to call for each interceptor
|
946
|
+
*/
|
947
|
+
InterceptorManager.prototype.forEach = function forEach(fn) {
|
948
|
+
utils.forEach(this.handlers, function forEachHandler(h) {
|
949
|
+
if (h !== null) {
|
950
|
+
fn(h);
|
951
|
+
}
|
952
|
+
});
|
953
|
+
};
|
954
|
+
|
955
|
+
var InterceptorManager_1 = InterceptorManager;
|
555
956
|
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
957
|
+
var normalizeHeaderName = function normalizeHeaderName(headers, normalizedName) {
|
958
|
+
utils.forEach(headers, function processHeader(value, name) {
|
959
|
+
if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
|
960
|
+
headers[normalizedName] = value;
|
961
|
+
delete headers[name];
|
962
|
+
}
|
963
|
+
});
|
964
|
+
};
|
965
|
+
|
966
|
+
var transitional = {
|
967
|
+
silentJSONParsing: true,
|
968
|
+
forcedJSONParsing: true,
|
969
|
+
clarifyTimeoutError: false
|
970
|
+
};
|
971
|
+
|
972
|
+
var URLSearchParams_1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams_1;
|
973
|
+
|
974
|
+
var FormData_1 = FormData;
|
975
|
+
|
976
|
+
var browser = {
|
977
|
+
isBrowser: true,
|
978
|
+
classes: {
|
979
|
+
URLSearchParams: URLSearchParams_1,
|
980
|
+
FormData: FormData_1,
|
981
|
+
Blob: Blob
|
982
|
+
},
|
983
|
+
protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
|
984
|
+
};
|
985
|
+
|
986
|
+
var platform = browser;
|
987
|
+
|
988
|
+
var toURLEncodedForm = function toURLEncodedForm(data, options) {
|
989
|
+
return toFormData_1(data, new platform.classes.URLSearchParams(), Object.assign({
|
990
|
+
visitor: function(value, key, path, helpers) {
|
991
|
+
if (platform.isNode && utils.isBuffer(value)) {
|
992
|
+
this.append(key, value.toString('base64'));
|
993
|
+
return false;
|
994
|
+
}
|
995
|
+
|
996
|
+
return helpers.defaultVisitor.apply(this, arguments);
|
997
|
+
}
|
998
|
+
}, options));
|
999
|
+
};
|
1000
|
+
|
1001
|
+
function parsePropPath(name) {
|
1002
|
+
// foo[x][y][z]
|
1003
|
+
// foo.x.y.z
|
1004
|
+
// foo-x-y-z
|
1005
|
+
// foo x y z
|
1006
|
+
return utils.matchAll(/\w+|\[(\w*)]/g, name).map(function(match) {
|
1007
|
+
return match[0] === '[]' ? '' : match[1] || match[0];
|
1008
|
+
});
|
562
1009
|
}
|
563
1010
|
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
1011
|
+
function arrayToObject(arr) {
|
1012
|
+
var obj = {};
|
1013
|
+
var keys = Object.keys(arr);
|
1014
|
+
var i;
|
1015
|
+
var len = keys.length;
|
1016
|
+
var key;
|
1017
|
+
for (i = 0; i < len; i++) {
|
1018
|
+
key = keys[i];
|
1019
|
+
obj[key] = arr[key];
|
570
1020
|
}
|
1021
|
+
return obj;
|
1022
|
+
}
|
571
1023
|
|
572
|
-
|
1024
|
+
function formDataToJSON(formData) {
|
1025
|
+
function buildPath(path, value, target, index) {
|
1026
|
+
var name = path[index++];
|
573
1027
|
|
574
|
-
|
575
|
-
});
|
1028
|
+
if (name === '__proto__') return true;
|
576
1029
|
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
1030
|
+
var isNumericKey = Number.isFinite(+name);
|
1031
|
+
var isLast = index >= path.length;
|
1032
|
+
name = !name && utils.isArray(target) ? target.length : name;
|
1033
|
+
|
1034
|
+
if (isLast) {
|
1035
|
+
if (utils.hasOwnProperty(target, name)) {
|
1036
|
+
target[name] = [target[name], value];
|
1037
|
+
} else {
|
1038
|
+
target[name] = value;
|
1039
|
+
}
|
581
1040
|
|
582
|
-
|
1041
|
+
return !isNumericKey;
|
1042
|
+
}
|
583
1043
|
|
584
|
-
|
585
|
-
|
1044
|
+
if (!target[name] || !utils.isObject(target[name])) {
|
1045
|
+
target[name] = [];
|
1046
|
+
}
|
586
1047
|
|
587
|
-
|
588
|
-
chain = chain.concat(responseInterceptorChain);
|
1048
|
+
var result = buildPath(path, value, target[name], index);
|
589
1049
|
|
590
|
-
|
591
|
-
|
592
|
-
|
1050
|
+
if (result && utils.isArray(target[name])) {
|
1051
|
+
target[name] = arrayToObject(target[name]);
|
1052
|
+
}
|
1053
|
+
|
1054
|
+
return !isNumericKey;
|
593
1055
|
}
|
594
1056
|
|
595
|
-
|
596
|
-
|
1057
|
+
if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
|
1058
|
+
var obj = {};
|
597
1059
|
|
1060
|
+
utils.forEachEntry(formData, function(name, value) {
|
1061
|
+
buildPath(parsePropPath(name), value, obj, 0);
|
1062
|
+
});
|
598
1063
|
|
599
|
-
|
600
|
-
while (requestInterceptorChain.length) {
|
601
|
-
var onFulfilled = requestInterceptorChain.shift();
|
602
|
-
var onRejected = requestInterceptorChain.shift();
|
603
|
-
try {
|
604
|
-
newConfig = onFulfilled(newConfig);
|
605
|
-
} catch (error) {
|
606
|
-
onRejected(error);
|
607
|
-
break;
|
1064
|
+
return obj;
|
608
1065
|
}
|
609
|
-
}
|
610
1066
|
|
611
|
-
|
612
|
-
promise = dispatchRequest(newConfig);
|
613
|
-
} catch (error) {
|
614
|
-
return Promise.reject(error);
|
1067
|
+
return null;
|
615
1068
|
}
|
616
1069
|
|
617
|
-
|
618
|
-
promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift());
|
619
|
-
}
|
1070
|
+
var formDataToJSON_1 = formDataToJSON;
|
620
1071
|
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
642
|
-
/*eslint func-names:0*/
|
643
|
-
Axios.prototype[method] = function(url, data, config) {
|
644
|
-
return this.request(mergeConfig(config || {}, {
|
645
|
-
method: method,
|
646
|
-
url: url,
|
647
|
-
data: data
|
648
|
-
}));
|
1072
|
+
/**
|
1073
|
+
* Resolve or reject a Promise based on response status.
|
1074
|
+
*
|
1075
|
+
* @param {Function} resolve A function that resolves the promise.
|
1076
|
+
* @param {Function} reject A function that rejects the promise.
|
1077
|
+
* @param {object} response The response.
|
1078
|
+
*/
|
1079
|
+
var settle = function settle(resolve, reject, response) {
|
1080
|
+
var validateStatus = response.config.validateStatus;
|
1081
|
+
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
1082
|
+
resolve(response);
|
1083
|
+
} else {
|
1084
|
+
reject(new AxiosError_1(
|
1085
|
+
'Request failed with status code ' + response.status,
|
1086
|
+
[AxiosError_1.ERR_BAD_REQUEST, AxiosError_1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
1087
|
+
response.config,
|
1088
|
+
response.request,
|
1089
|
+
response
|
1090
|
+
));
|
1091
|
+
}
|
649
1092
|
};
|
650
|
-
});
|
651
1093
|
|
652
|
-
|
1094
|
+
var cookies = (
|
1095
|
+
utils.isStandardBrowserEnv() ?
|
653
1096
|
|
1097
|
+
// Standard browser envs support document.cookie
|
1098
|
+
(function standardBrowserEnv() {
|
1099
|
+
return {
|
1100
|
+
write: function write(name, value, expires, path, domain, secure) {
|
1101
|
+
var cookie = [];
|
1102
|
+
cookie.push(name + '=' + encodeURIComponent(value));
|
654
1103
|
|
655
|
-
|
1104
|
+
if (utils.isNumber(expires)) {
|
1105
|
+
cookie.push('expires=' + new Date(expires).toGMTString());
|
1106
|
+
}
|
656
1107
|
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
\****************************************/
|
661
|
-
/*! no static exports found */
|
662
|
-
/***/ (function(module, exports, __webpack_require__) {
|
1108
|
+
if (utils.isString(path)) {
|
1109
|
+
cookie.push('path=' + path);
|
1110
|
+
}
|
663
1111
|
|
664
|
-
|
1112
|
+
if (utils.isString(domain)) {
|
1113
|
+
cookie.push('domain=' + domain);
|
1114
|
+
}
|
665
1115
|
|
1116
|
+
if (secure === true) {
|
1117
|
+
cookie.push('secure');
|
1118
|
+
}
|
666
1119
|
|
667
|
-
|
1120
|
+
document.cookie = cookie.join('; ');
|
1121
|
+
},
|
668
1122
|
|
669
|
-
function
|
670
|
-
|
671
|
-
|
1123
|
+
read: function read(name) {
|
1124
|
+
var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
1125
|
+
return (match ? decodeURIComponent(match[3]) : null);
|
1126
|
+
},
|
672
1127
|
|
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
|
-
|
1128
|
+
remove: function remove(name) {
|
1129
|
+
this.write(name, '', Date.now() - 86400000);
|
1130
|
+
}
|
1131
|
+
};
|
1132
|
+
})() :
|
1133
|
+
|
1134
|
+
// Non standard browser env (web workers, react-native) lack needed support.
|
1135
|
+
(function nonStandardBrowserEnv() {
|
1136
|
+
return {
|
1137
|
+
write: function write() {},
|
1138
|
+
read: function read() { return null; },
|
1139
|
+
remove: function remove() {}
|
1140
|
+
};
|
1141
|
+
})()
|
1142
|
+
);
|
1143
|
+
|
1144
|
+
/**
|
1145
|
+
* Determines whether the specified URL is absolute
|
1146
|
+
*
|
1147
|
+
* @param {string} url The URL to test
|
1148
|
+
* @returns {boolean} True if the specified URL is absolute, otherwise false
|
1149
|
+
*/
|
1150
|
+
var isAbsoluteURL = function isAbsoluteURL(url) {
|
1151
|
+
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
1152
|
+
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
1153
|
+
// by any combination of letters, digits, plus, period, or hyphen.
|
1154
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
1155
|
+
};
|
1156
|
+
|
1157
|
+
/**
|
1158
|
+
* Creates a new URL by combining the specified URLs
|
1159
|
+
*
|
1160
|
+
* @param {string} baseURL The base URL
|
1161
|
+
* @param {string} relativeURL The relative URL
|
1162
|
+
* @returns {string} The combined URL
|
1163
|
+
*/
|
1164
|
+
var combineURLs = function combineURLs(baseURL, relativeURL) {
|
1165
|
+
return relativeURL
|
1166
|
+
? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
1167
|
+
: baseURL;
|
1168
|
+
};
|
1169
|
+
|
1170
|
+
/**
|
1171
|
+
* Creates a new URL by combining the baseURL with the requestedURL,
|
1172
|
+
* only when the requestedURL is not already an absolute URL.
|
1173
|
+
* If the requestURL is absolute, this function returns the requestedURL untouched.
|
1174
|
+
*
|
1175
|
+
* @param {string} baseURL The base URL
|
1176
|
+
* @param {string} requestedURL Absolute or relative URL to combine
|
1177
|
+
* @param {boolean} allowAbsoluteUrls Set to true to allow absolute URLs
|
1178
|
+
*
|
1179
|
+
* @returns {string} The combined full path
|
1180
|
+
*/
|
1181
|
+
var buildFullPath = function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
1182
|
+
var isRelativeURL = !isAbsoluteURL(requestedURL);
|
1183
|
+
if (baseURL && (isRelativeURL || allowAbsoluteUrls === false)) {
|
1184
|
+
return combineURLs(baseURL, requestedURL);
|
714
1185
|
}
|
715
|
-
|
716
|
-
};
|
1186
|
+
return requestedURL;
|
1187
|
+
};
|
1188
|
+
|
1189
|
+
// Headers whose duplicates are ignored by node
|
1190
|
+
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
1191
|
+
var ignoreDuplicateOf = [
|
1192
|
+
'age', 'authorization', 'content-length', 'content-type', 'etag',
|
1193
|
+
'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
|
1194
|
+
'last-modified', 'location', 'max-forwards', 'proxy-authorization',
|
1195
|
+
'referer', 'retry-after', 'user-agent'
|
1196
|
+
];
|
1197
|
+
|
1198
|
+
/**
|
1199
|
+
* Parse headers into an object
|
1200
|
+
*
|
1201
|
+
* ```
|
1202
|
+
* Date: Wed, 27 Aug 2014 08:58:49 GMT
|
1203
|
+
* Content-Type: application/json
|
1204
|
+
* Connection: keep-alive
|
1205
|
+
* Transfer-Encoding: chunked
|
1206
|
+
* ```
|
1207
|
+
*
|
1208
|
+
* @param {String} headers Headers needing to be parsed
|
1209
|
+
* @returns {Object} Headers parsed into an object
|
1210
|
+
*/
|
1211
|
+
var parseHeaders = function parseHeaders(headers) {
|
1212
|
+
var parsed = {};
|
1213
|
+
var key;
|
1214
|
+
var val;
|
1215
|
+
var i;
|
1216
|
+
|
1217
|
+
if (!headers) { return parsed; }
|
1218
|
+
|
1219
|
+
utils.forEach(headers.split('\n'), function parser(line) {
|
1220
|
+
i = line.indexOf(':');
|
1221
|
+
key = utils.trim(line.slice(0, i)).toLowerCase();
|
1222
|
+
val = utils.trim(line.slice(i + 1));
|
717
1223
|
|
718
|
-
|
1224
|
+
if (key) {
|
1225
|
+
if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
|
1226
|
+
return;
|
1227
|
+
}
|
1228
|
+
if (key === 'set-cookie') {
|
1229
|
+
parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
|
1230
|
+
} else {
|
1231
|
+
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
1232
|
+
}
|
1233
|
+
}
|
1234
|
+
});
|
719
1235
|
|
1236
|
+
return parsed;
|
1237
|
+
};
|
720
1238
|
|
721
|
-
|
1239
|
+
var isURLSameOrigin = (
|
1240
|
+
utils.isStandardBrowserEnv() ?
|
1241
|
+
|
1242
|
+
// Standard browser envs have full support of the APIs needed to test
|
1243
|
+
// whether the request URL is of the same origin as current location.
|
1244
|
+
(function standardBrowserEnv() {
|
1245
|
+
var msie = /(msie|trident)/i.test(navigator.userAgent);
|
1246
|
+
var urlParsingNode = document.createElement('a');
|
1247
|
+
var originURL;
|
1248
|
+
|
1249
|
+
/**
|
1250
|
+
* Parse a URL to discover it's components
|
1251
|
+
*
|
1252
|
+
* @param {String} url The URL to be parsed
|
1253
|
+
* @returns {Object}
|
1254
|
+
*/
|
1255
|
+
function resolveURL(url) {
|
1256
|
+
var href = url;
|
1257
|
+
|
1258
|
+
if (msie) {
|
1259
|
+
// IE needs attribute set twice to normalize properties
|
1260
|
+
urlParsingNode.setAttribute('href', href);
|
1261
|
+
href = urlParsingNode.href;
|
1262
|
+
}
|
722
1263
|
|
723
|
-
|
724
|
-
/*!***********************************!*\
|
725
|
-
!*** ./lib/core/buildFullPath.js ***!
|
726
|
-
\***********************************/
|
727
|
-
/*! no static exports found */
|
728
|
-
/***/ (function(module, exports, __webpack_require__) {
|
1264
|
+
urlParsingNode.setAttribute('href', href);
|
729
1265
|
|
730
|
-
|
1266
|
+
// urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
|
1267
|
+
return {
|
1268
|
+
href: urlParsingNode.href,
|
1269
|
+
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
|
1270
|
+
host: urlParsingNode.host,
|
1271
|
+
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
|
1272
|
+
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
|
1273
|
+
hostname: urlParsingNode.hostname,
|
1274
|
+
port: urlParsingNode.port,
|
1275
|
+
pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
|
1276
|
+
urlParsingNode.pathname :
|
1277
|
+
'/' + urlParsingNode.pathname
|
1278
|
+
};
|
1279
|
+
}
|
731
1280
|
|
1281
|
+
originURL = resolveURL(window.location.href);
|
1282
|
+
|
1283
|
+
/**
|
1284
|
+
* Determine if a URL shares the same origin as the current location
|
1285
|
+
*
|
1286
|
+
* @param {String} requestURL The URL to test
|
1287
|
+
* @returns {boolean} True if URL shares the same origin, otherwise false
|
1288
|
+
*/
|
1289
|
+
return function isURLSameOrigin(requestURL) {
|
1290
|
+
var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
|
1291
|
+
return (parsed.protocol === originURL.protocol &&
|
1292
|
+
parsed.host === originURL.host);
|
1293
|
+
};
|
1294
|
+
})() :
|
732
1295
|
|
733
|
-
|
734
|
-
|
1296
|
+
// Non standard browser envs (web workers, react-native) lack needed support.
|
1297
|
+
(function nonStandardBrowserEnv() {
|
1298
|
+
return function isURLSameOrigin() {
|
1299
|
+
return true;
|
1300
|
+
};
|
1301
|
+
})()
|
1302
|
+
);
|
735
1303
|
|
736
|
-
/**
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
1304
|
+
/**
|
1305
|
+
* A `CanceledError` is an object that is thrown when an operation is canceled.
|
1306
|
+
*
|
1307
|
+
* @class
|
1308
|
+
* @param {string=} message The message.
|
1309
|
+
* @param {Object=} config The config.
|
1310
|
+
* @param {Object=} request The request.
|
1311
|
+
*/
|
1312
|
+
function CanceledError(message, config, request) {
|
1313
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
1314
|
+
AxiosError_1.call(this, message == null ? 'canceled' : message, AxiosError_1.ERR_CANCELED, config, request);
|
1315
|
+
this.name = 'CanceledError';
|
748
1316
|
}
|
749
|
-
return requestedURL;
|
750
|
-
};
|
751
1317
|
|
1318
|
+
utils.inherits(CanceledError, AxiosError_1, {
|
1319
|
+
__CANCEL__: true
|
1320
|
+
});
|
752
1321
|
|
753
|
-
|
1322
|
+
var CanceledError_1 = CanceledError;
|
754
1323
|
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
/*! no static exports found */
|
760
|
-
/***/ (function(module, exports, __webpack_require__) {
|
1324
|
+
var parseProtocol = function parseProtocol(url) {
|
1325
|
+
var match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
1326
|
+
return match && match[1] || '';
|
1327
|
+
};
|
761
1328
|
|
762
|
-
|
1329
|
+
var xhr = function xhrAdapter(config) {
|
1330
|
+
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
1331
|
+
var requestData = config.data;
|
1332
|
+
var requestHeaders = config.headers;
|
1333
|
+
var responseType = config.responseType;
|
1334
|
+
var withXSRFToken = config.withXSRFToken;
|
1335
|
+
var onCanceled;
|
1336
|
+
function done() {
|
1337
|
+
if (config.cancelToken) {
|
1338
|
+
config.cancelToken.unsubscribe(onCanceled);
|
1339
|
+
}
|
763
1340
|
|
1341
|
+
if (config.signal) {
|
1342
|
+
config.signal.removeEventListener('abort', onCanceled);
|
1343
|
+
}
|
1344
|
+
}
|
764
1345
|
|
765
|
-
|
1346
|
+
if (utils.isFormData(requestData) && utils.isStandardBrowserEnv()) {
|
1347
|
+
delete requestHeaders['Content-Type']; // Let the browser set it
|
1348
|
+
}
|
766
1349
|
|
767
|
-
|
768
|
-
* Create an Error with the specified message, config, error code, request and response.
|
769
|
-
*
|
770
|
-
* @param {string} message The error message.
|
771
|
-
* @param {Object} config The config.
|
772
|
-
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
773
|
-
* @param {Object} [request] The request.
|
774
|
-
* @param {Object} [response] The response.
|
775
|
-
* @returns {Error} The created error.
|
776
|
-
*/
|
777
|
-
module.exports = function createError(message, config, code, request, response) {
|
778
|
-
var error = new Error(message);
|
779
|
-
return enhanceError(error, config, code, request, response);
|
780
|
-
};
|
1350
|
+
var request = new XMLHttpRequest();
|
781
1351
|
|
1352
|
+
// HTTP basic authentication
|
1353
|
+
if (config.auth) {
|
1354
|
+
var username = config.auth.username || '';
|
1355
|
+
var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
|
1356
|
+
requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
|
1357
|
+
}
|
782
1358
|
|
783
|
-
|
1359
|
+
var fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
|
784
1360
|
|
785
|
-
|
786
|
-
/*!*************************************!*\
|
787
|
-
!*** ./lib/core/dispatchRequest.js ***!
|
788
|
-
\*************************************/
|
789
|
-
/*! no static exports found */
|
790
|
-
/***/ (function(module, exports, __webpack_require__) {
|
1361
|
+
request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
|
791
1362
|
|
792
|
-
|
1363
|
+
// Set the request timeout in MS
|
1364
|
+
request.timeout = config.timeout;
|
793
1365
|
|
1366
|
+
function onloadend() {
|
1367
|
+
if (!request) {
|
1368
|
+
return;
|
1369
|
+
}
|
1370
|
+
// Prepare the response
|
1371
|
+
var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
|
1372
|
+
var responseData = !responseType || responseType === 'text' || responseType === 'json' ?
|
1373
|
+
request.responseText : request.response;
|
1374
|
+
var response = {
|
1375
|
+
data: responseData,
|
1376
|
+
status: request.status,
|
1377
|
+
statusText: request.statusText,
|
1378
|
+
headers: responseHeaders,
|
1379
|
+
config: config,
|
1380
|
+
request: request
|
1381
|
+
};
|
794
1382
|
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
1383
|
+
settle(function _resolve(value) {
|
1384
|
+
resolve(value);
|
1385
|
+
done();
|
1386
|
+
}, function _reject(err) {
|
1387
|
+
reject(err);
|
1388
|
+
done();
|
1389
|
+
}, response);
|
799
1390
|
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
function throwIfCancellationRequested(config) {
|
804
|
-
if (config.cancelToken) {
|
805
|
-
config.cancelToken.throwIfRequested();
|
806
|
-
}
|
807
|
-
}
|
808
|
-
|
809
|
-
/**
|
810
|
-
* Dispatch a request to the server using the configured adapter.
|
811
|
-
*
|
812
|
-
* @param {object} config The config that is to be used for the request
|
813
|
-
* @returns {Promise} The Promise to be fulfilled
|
814
|
-
*/
|
815
|
-
module.exports = function dispatchRequest(config) {
|
816
|
-
throwIfCancellationRequested(config);
|
817
|
-
|
818
|
-
// Ensure headers exist
|
819
|
-
config.headers = config.headers || {};
|
820
|
-
|
821
|
-
// Transform request data
|
822
|
-
config.data = transformData.call(
|
823
|
-
config,
|
824
|
-
config.data,
|
825
|
-
config.headers,
|
826
|
-
config.transformRequest
|
827
|
-
);
|
1391
|
+
// Clean up request
|
1392
|
+
request = null;
|
1393
|
+
}
|
828
1394
|
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
1395
|
+
if ('onloadend' in request) {
|
1396
|
+
// Use onloadend if available
|
1397
|
+
request.onloadend = onloadend;
|
1398
|
+
} else {
|
1399
|
+
// Listen for ready state to emulate onloadend
|
1400
|
+
request.onreadystatechange = function handleLoad() {
|
1401
|
+
if (!request || request.readyState !== 4) {
|
1402
|
+
return;
|
1403
|
+
}
|
835
1404
|
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
1405
|
+
// The request errored out and we didn't get a response, this will be
|
1406
|
+
// handled by onerror instead
|
1407
|
+
// With one exception: request that using file: protocol, most browsers
|
1408
|
+
// will return status as 0 even though it's a successful request
|
1409
|
+
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
|
1410
|
+
return;
|
1411
|
+
}
|
1412
|
+
// readystate handler is calling before onerror or ontimeout handlers,
|
1413
|
+
// so we should call onloadend on the next 'tick'
|
1414
|
+
setTimeout(onloadend);
|
1415
|
+
};
|
1416
|
+
}
|
842
1417
|
|
843
|
-
|
1418
|
+
// Handle browser request cancellation (as opposed to a manual cancellation)
|
1419
|
+
request.onabort = function handleAbort() {
|
1420
|
+
if (!request) {
|
1421
|
+
return;
|
1422
|
+
}
|
844
1423
|
|
845
|
-
|
846
|
-
throwIfCancellationRequested(config);
|
1424
|
+
reject(new AxiosError_1('Request aborted', AxiosError_1.ECONNABORTED, config, request));
|
847
1425
|
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
response.data,
|
852
|
-
response.headers,
|
853
|
-
config.transformResponse
|
854
|
-
);
|
1426
|
+
// Clean up request
|
1427
|
+
request = null;
|
1428
|
+
};
|
855
1429
|
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
1430
|
+
// Handle low level network errors
|
1431
|
+
request.onerror = function handleError() {
|
1432
|
+
// Real errors are hidden from us by the browser
|
1433
|
+
// onerror should only fire if it's a network error
|
1434
|
+
reject(new AxiosError_1('Network Error', AxiosError_1.ERR_NETWORK, config, request));
|
860
1435
|
|
861
|
-
|
862
|
-
|
863
|
-
|
1436
|
+
// Clean up request
|
1437
|
+
request = null;
|
1438
|
+
};
|
1439
|
+
|
1440
|
+
// Handle timeout
|
1441
|
+
request.ontimeout = function handleTimeout() {
|
1442
|
+
var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
|
1443
|
+
var transitional$1 = config.transitional || transitional;
|
1444
|
+
if (config.timeoutErrorMessage) {
|
1445
|
+
timeoutErrorMessage = config.timeoutErrorMessage;
|
1446
|
+
}
|
1447
|
+
reject(new AxiosError_1(
|
1448
|
+
timeoutErrorMessage,
|
1449
|
+
transitional$1.clarifyTimeoutError ? AxiosError_1.ETIMEDOUT : AxiosError_1.ECONNABORTED,
|
864
1450
|
config,
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
1451
|
+
request));
|
1452
|
+
|
1453
|
+
// Clean up request
|
1454
|
+
request = null;
|
1455
|
+
};
|
1456
|
+
|
1457
|
+
// Add xsrf header
|
1458
|
+
// This is only done if running in a standard browser environment.
|
1459
|
+
// Specifically not if we're in a web worker, or react-native.
|
1460
|
+
if (utils.isStandardBrowserEnv()) {
|
1461
|
+
// Add xsrf header
|
1462
|
+
withXSRFToken && utils.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
|
1463
|
+
if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
|
1464
|
+
// Add xsrf header
|
1465
|
+
var xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
|
1466
|
+
if (xsrfValue) {
|
1467
|
+
requestHeaders[config.xsrfHeaderName] = xsrfValue;
|
1468
|
+
}
|
1469
|
+
}
|
869
1470
|
}
|
870
|
-
}
|
871
1471
|
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
/***/ (function(module, exports, __webpack_require__) {
|
885
|
-
|
886
|
-
"use strict";
|
887
|
-
|
888
|
-
|
889
|
-
/**
|
890
|
-
* Update an Error with the specified config, error code, and response.
|
891
|
-
*
|
892
|
-
* @param {Error} error The error to update.
|
893
|
-
* @param {Object} config The config.
|
894
|
-
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
895
|
-
* @param {Object} [request] The request.
|
896
|
-
* @param {Object} [response] The response.
|
897
|
-
* @returns {Error} The error.
|
898
|
-
*/
|
899
|
-
module.exports = function enhanceError(error, config, code, request, response) {
|
900
|
-
error.config = config;
|
901
|
-
if (code) {
|
902
|
-
error.code = code;
|
903
|
-
}
|
1472
|
+
// Add headers to the request
|
1473
|
+
if ('setRequestHeader' in request) {
|
1474
|
+
utils.forEach(requestHeaders, function setRequestHeader(val, key) {
|
1475
|
+
if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
|
1476
|
+
// Remove Content-Type if data is undefined
|
1477
|
+
delete requestHeaders[key];
|
1478
|
+
} else {
|
1479
|
+
// Otherwise add header to the request
|
1480
|
+
request.setRequestHeader(key, val);
|
1481
|
+
}
|
1482
|
+
});
|
1483
|
+
}
|
904
1484
|
|
905
|
-
|
906
|
-
|
907
|
-
|
1485
|
+
// Add withCredentials to request if needed
|
1486
|
+
if (!utils.isUndefined(config.withCredentials)) {
|
1487
|
+
request.withCredentials = !!config.withCredentials;
|
1488
|
+
}
|
908
1489
|
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
name: this.name,
|
914
|
-
// Microsoft
|
915
|
-
description: this.description,
|
916
|
-
number: this.number,
|
917
|
-
// Mozilla
|
918
|
-
fileName: this.fileName,
|
919
|
-
lineNumber: this.lineNumber,
|
920
|
-
columnNumber: this.columnNumber,
|
921
|
-
stack: this.stack,
|
922
|
-
// Axios
|
923
|
-
config: this.config,
|
924
|
-
code: this.code
|
925
|
-
};
|
926
|
-
};
|
927
|
-
return error;
|
928
|
-
};
|
929
|
-
|
930
|
-
|
931
|
-
/***/ }),
|
932
|
-
|
933
|
-
/***/ "./lib/core/mergeConfig.js":
|
934
|
-
/*!*********************************!*\
|
935
|
-
!*** ./lib/core/mergeConfig.js ***!
|
936
|
-
\*********************************/
|
937
|
-
/*! no static exports found */
|
938
|
-
/***/ (function(module, exports, __webpack_require__) {
|
939
|
-
|
940
|
-
"use strict";
|
941
|
-
|
942
|
-
|
943
|
-
var utils = __webpack_require__(/*! ../utils */ "./lib/utils.js");
|
944
|
-
|
945
|
-
/**
|
946
|
-
* Config-specific merge-function which creates a new config-object
|
947
|
-
* by merging two configuration objects together.
|
948
|
-
*
|
949
|
-
* @param {Object} config1
|
950
|
-
* @param {Object} config2
|
951
|
-
* @returns {Object} New object resulting from merging config2 to config1
|
952
|
-
*/
|
953
|
-
module.exports = function mergeConfig(config1, config2) {
|
954
|
-
// eslint-disable-next-line no-param-reassign
|
955
|
-
config2 = config2 || {};
|
956
|
-
var config = {};
|
957
|
-
|
958
|
-
var valueFromConfig2Keys = ['url', 'method', 'data'];
|
959
|
-
var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params'];
|
960
|
-
var defaultToConfig2Keys = [
|
961
|
-
'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',
|
962
|
-
'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
|
963
|
-
'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress',
|
964
|
-
'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent',
|
965
|
-
'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding'
|
966
|
-
];
|
967
|
-
var directMergeKeys = ['validateStatus'];
|
968
|
-
|
969
|
-
function getMergedValue(target, source) {
|
970
|
-
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
971
|
-
return utils.merge(target, source);
|
972
|
-
} else if (utils.isPlainObject(source)) {
|
973
|
-
return utils.merge({}, source);
|
974
|
-
} else if (utils.isArray(source)) {
|
975
|
-
return source.slice();
|
976
|
-
}
|
977
|
-
return source;
|
978
|
-
}
|
1490
|
+
// Add responseType to request if needed
|
1491
|
+
if (responseType && responseType !== 'json') {
|
1492
|
+
request.responseType = config.responseType;
|
1493
|
+
}
|
979
1494
|
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
config[prop] = getMergedValue(undefined, config1[prop]);
|
985
|
-
}
|
986
|
-
}
|
1495
|
+
// Handle progress if needed
|
1496
|
+
if (typeof config.onDownloadProgress === 'function') {
|
1497
|
+
request.addEventListener('progress', config.onDownloadProgress);
|
1498
|
+
}
|
987
1499
|
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
});
|
1500
|
+
// Not all browsers support upload events
|
1501
|
+
if (typeof config.onUploadProgress === 'function' && request.upload) {
|
1502
|
+
request.upload.addEventListener('progress', config.onUploadProgress);
|
1503
|
+
}
|
993
1504
|
|
994
|
-
|
1505
|
+
if (config.cancelToken || config.signal) {
|
1506
|
+
// Handle cancellation
|
1507
|
+
// eslint-disable-next-line func-names
|
1508
|
+
onCanceled = function(cancel) {
|
1509
|
+
if (!request) {
|
1510
|
+
return;
|
1511
|
+
}
|
1512
|
+
reject(!cancel || cancel.type ? new CanceledError_1(null, config, request) : cancel);
|
1513
|
+
request.abort();
|
1514
|
+
request = null;
|
1515
|
+
};
|
995
1516
|
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
}
|
1002
|
-
});
|
1517
|
+
config.cancelToken && config.cancelToken.subscribe(onCanceled);
|
1518
|
+
if (config.signal) {
|
1519
|
+
config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
|
1520
|
+
}
|
1521
|
+
}
|
1003
1522
|
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1523
|
+
// false, 0 (zero number), and '' (empty string) are valid JSON values
|
1524
|
+
if (!requestData && requestData !== false && requestData !== 0 && requestData !== '') {
|
1525
|
+
requestData = null;
|
1526
|
+
}
|
1527
|
+
|
1528
|
+
var protocol = parseProtocol(fullPath);
|
1529
|
+
|
1530
|
+
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
1531
|
+
reject(new AxiosError_1('Unsupported protocol ' + protocol + ':', AxiosError_1.ERR_BAD_REQUEST, config));
|
1532
|
+
return;
|
1533
|
+
}
|
1011
1534
|
|
1012
|
-
var axiosKeys = valueFromConfig2Keys
|
1013
|
-
.concat(mergeDeepPropertiesKeys)
|
1014
|
-
.concat(defaultToConfig2Keys)
|
1015
|
-
.concat(directMergeKeys);
|
1016
1535
|
|
1017
|
-
|
1018
|
-
|
1019
|
-
.concat(Object.keys(config2))
|
1020
|
-
.filter(function filterAxiosKeys(key) {
|
1021
|
-
return axiosKeys.indexOf(key) === -1;
|
1536
|
+
// Send the request
|
1537
|
+
request.send(requestData);
|
1022
1538
|
});
|
1539
|
+
};
|
1023
1540
|
|
1024
|
-
|
1541
|
+
var DEFAULT_CONTENT_TYPE = {
|
1542
|
+
'Content-Type': 'application/x-www-form-urlencoded'
|
1543
|
+
};
|
1025
1544
|
|
1026
|
-
|
1027
|
-
|
1545
|
+
function setContentTypeIfUnset(headers, value) {
|
1546
|
+
if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
|
1547
|
+
headers['Content-Type'] = value;
|
1548
|
+
}
|
1549
|
+
}
|
1550
|
+
|
1551
|
+
function getDefaultAdapter() {
|
1552
|
+
var adapter;
|
1553
|
+
if (typeof XMLHttpRequest !== 'undefined') {
|
1554
|
+
// For browsers use XHR adapter
|
1555
|
+
adapter = xhr;
|
1556
|
+
} else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
|
1557
|
+
// For node use HTTP adapter
|
1558
|
+
adapter = xhr;
|
1559
|
+
}
|
1560
|
+
return adapter;
|
1561
|
+
}
|
1028
1562
|
|
1563
|
+
function stringifySafely(rawValue, parser, encoder) {
|
1564
|
+
if (utils.isString(rawValue)) {
|
1565
|
+
try {
|
1566
|
+
(parser || JSON.parse)(rawValue);
|
1567
|
+
return utils.trim(rawValue);
|
1568
|
+
} catch (e) {
|
1569
|
+
if (e.name !== 'SyntaxError') {
|
1570
|
+
throw e;
|
1571
|
+
}
|
1572
|
+
}
|
1573
|
+
}
|
1029
1574
|
|
1030
|
-
|
1575
|
+
return (encoder || JSON.stringify)(rawValue);
|
1576
|
+
}
|
1031
1577
|
|
1032
|
-
|
1033
|
-
/*!****************************!*\
|
1034
|
-
!*** ./lib/core/settle.js ***!
|
1035
|
-
\****************************/
|
1036
|
-
/*! no static exports found */
|
1037
|
-
/***/ (function(module, exports, __webpack_require__) {
|
1578
|
+
var defaults = {
|
1038
1579
|
|
1039
|
-
|
1580
|
+
transitional: transitional,
|
1040
1581
|
|
1582
|
+
adapter: getDefaultAdapter(),
|
1041
1583
|
|
1042
|
-
|
1584
|
+
transformRequest: [function transformRequest(data, headers) {
|
1585
|
+
normalizeHeaderName(headers, 'Accept');
|
1586
|
+
normalizeHeaderName(headers, 'Content-Type');
|
1043
1587
|
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
* @param {Function} resolve A function that resolves the promise.
|
1048
|
-
* @param {Function} reject A function that rejects the promise.
|
1049
|
-
* @param {object} response The response.
|
1050
|
-
*/
|
1051
|
-
module.exports = function settle(resolve, reject, response) {
|
1052
|
-
var validateStatus = response.config.validateStatus;
|
1053
|
-
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
1054
|
-
resolve(response);
|
1055
|
-
} else {
|
1056
|
-
reject(createError(
|
1057
|
-
'Request failed with status code ' + response.status,
|
1058
|
-
response.config,
|
1059
|
-
null,
|
1060
|
-
response.request,
|
1061
|
-
response
|
1062
|
-
));
|
1063
|
-
}
|
1064
|
-
};
|
1588
|
+
var contentType = headers && headers['Content-Type'] || '';
|
1589
|
+
var hasJSONContentType = contentType.indexOf('application/json') > -1;
|
1590
|
+
var isObjectPayload = utils.isObject(data);
|
1065
1591
|
|
1592
|
+
if (isObjectPayload && utils.isHTMLForm(data)) {
|
1593
|
+
data = new FormData(data);
|
1594
|
+
}
|
1066
1595
|
|
1067
|
-
|
1596
|
+
var isFormData = utils.isFormData(data);
|
1068
1597
|
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
\***********************************/
|
1073
|
-
/*! no static exports found */
|
1074
|
-
/***/ (function(module, exports, __webpack_require__) {
|
1598
|
+
if (isFormData) {
|
1599
|
+
return hasJSONContentType ? JSON.stringify(formDataToJSON_1(data)) : data;
|
1600
|
+
}
|
1075
1601
|
|
1076
|
-
|
1602
|
+
if (utils.isArrayBuffer(data) ||
|
1603
|
+
utils.isBuffer(data) ||
|
1604
|
+
utils.isStream(data) ||
|
1605
|
+
utils.isFile(data) ||
|
1606
|
+
utils.isBlob(data)
|
1607
|
+
) {
|
1608
|
+
return data;
|
1609
|
+
}
|
1610
|
+
if (utils.isArrayBufferView(data)) {
|
1611
|
+
return data.buffer;
|
1612
|
+
}
|
1613
|
+
if (utils.isURLSearchParams(data)) {
|
1614
|
+
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
|
1615
|
+
return data.toString();
|
1616
|
+
}
|
1077
1617
|
|
1618
|
+
var isFileList;
|
1078
1619
|
|
1079
|
-
|
1080
|
-
|
1620
|
+
if (isObjectPayload) {
|
1621
|
+
if (contentType.indexOf('application/x-www-form-urlencoded') !== -1) {
|
1622
|
+
return toURLEncodedForm(data, this.formSerializer).toString();
|
1623
|
+
}
|
1081
1624
|
|
1082
|
-
|
1083
|
-
|
1084
|
-
*
|
1085
|
-
* @param {Object|String} data The data to be transformed
|
1086
|
-
* @param {Array} headers The headers for the request or response
|
1087
|
-
* @param {Array|Function} fns A single function or Array of functions
|
1088
|
-
* @returns {*} The resulting transformed data
|
1089
|
-
*/
|
1090
|
-
module.exports = function transformData(data, headers, fns) {
|
1091
|
-
var context = this || defaults;
|
1092
|
-
/*eslint no-param-reassign:0*/
|
1093
|
-
utils.forEach(fns, function transform(fn) {
|
1094
|
-
data = fn.call(context, data, headers);
|
1095
|
-
});
|
1625
|
+
if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
|
1626
|
+
var _FormData = this.env && this.env.FormData;
|
1096
1627
|
|
1097
|
-
|
1098
|
-
}
|
1628
|
+
return toFormData_1(
|
1629
|
+
isFileList ? {'files[]': data} : data,
|
1630
|
+
_FormData && new _FormData(),
|
1631
|
+
this.formSerializer
|
1632
|
+
);
|
1633
|
+
}
|
1634
|
+
}
|
1099
1635
|
|
1636
|
+
if (isObjectPayload || hasJSONContentType ) {
|
1637
|
+
setContentTypeIfUnset(headers, 'application/json');
|
1638
|
+
return stringifySafely(data);
|
1639
|
+
}
|
1100
1640
|
|
1101
|
-
|
1641
|
+
return data;
|
1642
|
+
}],
|
1643
|
+
|
1644
|
+
transformResponse: [function transformResponse(data) {
|
1645
|
+
var transitional = this.transitional || defaults.transitional;
|
1646
|
+
var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
1647
|
+
var JSONRequested = this.responseType === 'json';
|
1648
|
+
|
1649
|
+
if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
|
1650
|
+
var silentJSONParsing = transitional && transitional.silentJSONParsing;
|
1651
|
+
var strictJSONParsing = !silentJSONParsing && JSONRequested;
|
1652
|
+
|
1653
|
+
try {
|
1654
|
+
return JSON.parse(data);
|
1655
|
+
} catch (e) {
|
1656
|
+
if (strictJSONParsing) {
|
1657
|
+
if (e.name === 'SyntaxError') {
|
1658
|
+
throw AxiosError_1.from(e, AxiosError_1.ERR_BAD_RESPONSE, this, null, this.response);
|
1659
|
+
}
|
1660
|
+
throw e;
|
1661
|
+
}
|
1662
|
+
}
|
1663
|
+
}
|
1102
1664
|
|
1103
|
-
|
1104
|
-
|
1105
|
-
!*** ./lib/defaults.js ***!
|
1106
|
-
\*************************/
|
1107
|
-
/*! no static exports found */
|
1108
|
-
/***/ (function(module, exports, __webpack_require__) {
|
1665
|
+
return data;
|
1666
|
+
}],
|
1109
1667
|
|
1110
|
-
|
1668
|
+
/**
|
1669
|
+
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
1670
|
+
* timeout is not created.
|
1671
|
+
*/
|
1672
|
+
timeout: 0,
|
1111
1673
|
|
1674
|
+
xsrfCookieName: 'XSRF-TOKEN',
|
1675
|
+
xsrfHeaderName: 'X-XSRF-TOKEN',
|
1112
1676
|
|
1113
|
-
|
1114
|
-
|
1115
|
-
var enhanceError = __webpack_require__(/*! ./core/enhanceError */ "./lib/core/enhanceError.js");
|
1677
|
+
maxContentLength: -1,
|
1678
|
+
maxBodyLength: -1,
|
1116
1679
|
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1680
|
+
env: {
|
1681
|
+
FormData: platform.classes.FormData,
|
1682
|
+
Blob: platform.classes.Blob
|
1683
|
+
},
|
1120
1684
|
|
1121
|
-
function
|
1122
|
-
|
1123
|
-
|
1124
|
-
}
|
1125
|
-
}
|
1126
|
-
|
1127
|
-
function getDefaultAdapter() {
|
1128
|
-
var adapter;
|
1129
|
-
if (typeof XMLHttpRequest !== 'undefined') {
|
1130
|
-
// For browsers use XHR adapter
|
1131
|
-
adapter = __webpack_require__(/*! ./adapters/xhr */ "./lib/adapters/xhr.js");
|
1132
|
-
} else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
|
1133
|
-
// For node use HTTP adapter
|
1134
|
-
adapter = __webpack_require__(/*! ./adapters/http */ "./lib/adapters/xhr.js");
|
1135
|
-
}
|
1136
|
-
return adapter;
|
1137
|
-
}
|
1685
|
+
validateStatus: function validateStatus(status) {
|
1686
|
+
return status >= 200 && status < 300;
|
1687
|
+
},
|
1138
1688
|
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
(parser || JSON.parse)(rawValue);
|
1143
|
-
return utils.trim(rawValue);
|
1144
|
-
} catch (e) {
|
1145
|
-
if (e.name !== 'SyntaxError') {
|
1146
|
-
throw e;
|
1689
|
+
headers: {
|
1690
|
+
common: {
|
1691
|
+
'Accept': 'application/json, text/plain, */*'
|
1147
1692
|
}
|
1148
1693
|
}
|
1149
|
-
}
|
1150
|
-
|
1151
|
-
return (encoder || JSON.stringify)(rawValue);
|
1152
|
-
}
|
1694
|
+
};
|
1153
1695
|
|
1154
|
-
|
1696
|
+
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
|
1697
|
+
defaults.headers[method] = {};
|
1698
|
+
});
|
1155
1699
|
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
clarifyTimeoutError: false
|
1160
|
-
},
|
1700
|
+
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
1701
|
+
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
|
1702
|
+
});
|
1161
1703
|
|
1162
|
-
|
1704
|
+
var defaults_1 = defaults;
|
1163
1705
|
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1706
|
+
/**
|
1707
|
+
* Transform the data for a request or a response
|
1708
|
+
*
|
1709
|
+
* @param {Object|String} data The data to be transformed
|
1710
|
+
* @param {Array} headers The headers for the request or response
|
1711
|
+
* @param {Number} status HTTP status code
|
1712
|
+
* @param {Array|Function} fns A single function or Array of functions
|
1713
|
+
* @returns {*} The resulting transformed data
|
1714
|
+
*/
|
1715
|
+
var transformData = function transformData(data, headers, status, fns) {
|
1716
|
+
var context = this || defaults_1;
|
1717
|
+
/*eslint no-param-reassign:0*/
|
1718
|
+
utils.forEach(fns, function transform(fn) {
|
1719
|
+
data = fn.call(context, data, headers, status);
|
1720
|
+
});
|
1167
1721
|
|
1168
|
-
if (utils.isFormData(data) ||
|
1169
|
-
utils.isArrayBuffer(data) ||
|
1170
|
-
utils.isBuffer(data) ||
|
1171
|
-
utils.isStream(data) ||
|
1172
|
-
utils.isFile(data) ||
|
1173
|
-
utils.isBlob(data)
|
1174
|
-
) {
|
1175
|
-
return data;
|
1176
|
-
}
|
1177
|
-
if (utils.isArrayBufferView(data)) {
|
1178
|
-
return data.buffer;
|
1179
|
-
}
|
1180
|
-
if (utils.isURLSearchParams(data)) {
|
1181
|
-
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
|
1182
|
-
return data.toString();
|
1183
|
-
}
|
1184
|
-
if (utils.isObject(data) || (headers && headers['Content-Type'] === 'application/json')) {
|
1185
|
-
setContentTypeIfUnset(headers, 'application/json');
|
1186
|
-
return stringifySafely(data);
|
1187
|
-
}
|
1188
1722
|
return data;
|
1189
|
-
}
|
1723
|
+
};
|
1190
1724
|
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
1195
|
-
var strictJSONParsing = !silentJSONParsing && this.responseType === 'json';
|
1725
|
+
var isCancel = function isCancel(value) {
|
1726
|
+
return !!(value && value.__CANCEL__);
|
1727
|
+
};
|
1196
1728
|
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
throw enhanceError(e, this, 'E_JSON_PARSE');
|
1204
|
-
}
|
1205
|
-
throw e;
|
1206
|
-
}
|
1207
|
-
}
|
1729
|
+
/**
|
1730
|
+
* Throws a `CanceledError` if cancellation has been requested.
|
1731
|
+
*/
|
1732
|
+
function throwIfCancellationRequested(config) {
|
1733
|
+
if (config.cancelToken) {
|
1734
|
+
config.cancelToken.throwIfRequested();
|
1208
1735
|
}
|
1209
1736
|
|
1210
|
-
|
1211
|
-
|
1737
|
+
if (config.signal && config.signal.aborted) {
|
1738
|
+
throw new CanceledError_1();
|
1739
|
+
}
|
1740
|
+
}
|
1212
1741
|
|
1213
1742
|
/**
|
1214
|
-
*
|
1215
|
-
*
|
1743
|
+
* Dispatch a request to the server using the configured adapter.
|
1744
|
+
*
|
1745
|
+
* @param {object} config The config that is to be used for the request
|
1746
|
+
* @returns {Promise} The Promise to be fulfilled
|
1216
1747
|
*/
|
1217
|
-
|
1218
|
-
|
1219
|
-
xsrfCookieName: 'XSRF-TOKEN',
|
1220
|
-
xsrfHeaderName: 'X-XSRF-TOKEN',
|
1748
|
+
var dispatchRequest = function dispatchRequest(config) {
|
1749
|
+
throwIfCancellationRequested(config);
|
1221
1750
|
|
1222
|
-
|
1223
|
-
|
1751
|
+
// Ensure headers exist
|
1752
|
+
config.headers = config.headers || {};
|
1224
1753
|
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1754
|
+
// Transform request data
|
1755
|
+
config.data = transformData.call(
|
1756
|
+
config,
|
1757
|
+
config.data,
|
1758
|
+
config.headers,
|
1759
|
+
null,
|
1760
|
+
config.transformRequest
|
1761
|
+
);
|
1229
1762
|
|
1230
|
-
|
1231
|
-
|
1232
|
-
'Accept': 'application/json, text/plain, */*'
|
1233
|
-
}
|
1234
|
-
};
|
1763
|
+
normalizeHeaderName(config.headers, 'Accept');
|
1764
|
+
normalizeHeaderName(config.headers, 'Content-Type');
|
1235
1765
|
|
1236
|
-
|
1237
|
-
|
1238
|
-
}
|
1766
|
+
// Flatten headers
|
1767
|
+
config.headers = utils.merge(
|
1768
|
+
config.headers.common || {},
|
1769
|
+
config.headers[config.method] || {},
|
1770
|
+
config.headers
|
1771
|
+
);
|
1239
1772
|
|
1240
|
-
utils.forEach(
|
1241
|
-
|
1242
|
-
|
1773
|
+
utils.forEach(
|
1774
|
+
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
1775
|
+
function cleanHeaderConfig(method) {
|
1776
|
+
delete config.headers[method];
|
1777
|
+
}
|
1778
|
+
);
|
1243
1779
|
|
1244
|
-
|
1780
|
+
var adapter = config.adapter || defaults_1.adapter;
|
1245
1781
|
|
1782
|
+
return adapter(config).then(function onAdapterResolution(response) {
|
1783
|
+
throwIfCancellationRequested(config);
|
1246
1784
|
|
1247
|
-
|
1785
|
+
// Transform response data
|
1786
|
+
response.data = transformData.call(
|
1787
|
+
config,
|
1788
|
+
response.data,
|
1789
|
+
response.headers,
|
1790
|
+
response.status,
|
1791
|
+
config.transformResponse
|
1792
|
+
);
|
1248
1793
|
|
1249
|
-
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1794
|
+
return response;
|
1795
|
+
}, function onAdapterRejection(reason) {
|
1796
|
+
if (!isCancel(reason)) {
|
1797
|
+
throwIfCancellationRequested(config);
|
1798
|
+
|
1799
|
+
// Transform response data
|
1800
|
+
if (reason && reason.response) {
|
1801
|
+
reason.response.data = transformData.call(
|
1802
|
+
config,
|
1803
|
+
reason.response.data,
|
1804
|
+
reason.response.headers,
|
1805
|
+
reason.response.status,
|
1806
|
+
config.transformResponse
|
1807
|
+
);
|
1808
|
+
}
|
1809
|
+
}
|
1255
1810
|
|
1256
|
-
|
1811
|
+
return Promise.reject(reason);
|
1812
|
+
});
|
1813
|
+
};
|
1257
1814
|
|
1815
|
+
/**
|
1816
|
+
* Config-specific merge-function which creates a new config-object
|
1817
|
+
* by merging two configuration objects together.
|
1818
|
+
*
|
1819
|
+
* @param {Object} config1
|
1820
|
+
* @param {Object} config2
|
1821
|
+
* @returns {Object} New object resulting from merging config2 to config1
|
1822
|
+
*/
|
1823
|
+
var mergeConfig = function mergeConfig(config1, config2) {
|
1824
|
+
// eslint-disable-next-line no-param-reassign
|
1825
|
+
config2 = config2 || {};
|
1826
|
+
var config = {};
|
1827
|
+
|
1828
|
+
function getMergedValue(target, source) {
|
1829
|
+
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
1830
|
+
return utils.merge(target, source);
|
1831
|
+
} else if (utils.isEmptyObject(source)) {
|
1832
|
+
return utils.merge({}, target);
|
1833
|
+
} else if (utils.isPlainObject(source)) {
|
1834
|
+
return utils.merge({}, source);
|
1835
|
+
} else if (utils.isArray(source)) {
|
1836
|
+
return source.slice();
|
1837
|
+
}
|
1838
|
+
return source;
|
1839
|
+
}
|
1258
1840
|
|
1259
|
-
|
1260
|
-
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1841
|
+
// eslint-disable-next-line consistent-return
|
1842
|
+
function mergeDeepProperties(prop) {
|
1843
|
+
if (!utils.isUndefined(config2[prop])) {
|
1844
|
+
return getMergedValue(config1[prop], config2[prop]);
|
1845
|
+
} else if (!utils.isUndefined(config1[prop])) {
|
1846
|
+
return getMergedValue(undefined, config1[prop]);
|
1847
|
+
}
|
1264
1848
|
}
|
1265
|
-
return fn.apply(thisArg, args);
|
1266
|
-
};
|
1267
|
-
};
|
1268
|
-
|
1269
|
-
|
1270
|
-
/***/ }),
|
1271
|
-
|
1272
|
-
/***/ "./lib/helpers/buildURL.js":
|
1273
|
-
/*!*********************************!*\
|
1274
|
-
!*** ./lib/helpers/buildURL.js ***!
|
1275
|
-
\*********************************/
|
1276
|
-
/*! no static exports found */
|
1277
|
-
/***/ (function(module, exports, __webpack_require__) {
|
1278
|
-
|
1279
|
-
"use strict";
|
1280
|
-
|
1281
|
-
|
1282
|
-
var utils = __webpack_require__(/*! ./../utils */ "./lib/utils.js");
|
1283
|
-
|
1284
|
-
function encode(val) {
|
1285
|
-
return encodeURIComponent(val).
|
1286
|
-
replace(/%3A/gi, ':').
|
1287
|
-
replace(/%24/g, '$').
|
1288
|
-
replace(/%2C/gi, ',').
|
1289
|
-
replace(/%20/g, '+').
|
1290
|
-
replace(/%5B/gi, '[').
|
1291
|
-
replace(/%5D/gi, ']');
|
1292
|
-
}
|
1293
|
-
|
1294
|
-
/**
|
1295
|
-
* Build a URL by appending params to the end
|
1296
|
-
*
|
1297
|
-
* @param {string} url The base of the url (e.g., http://www.google.com)
|
1298
|
-
* @param {object} [params] The params to be appended
|
1299
|
-
* @returns {string} The formatted url
|
1300
|
-
*/
|
1301
|
-
module.exports = function buildURL(url, params, paramsSerializer) {
|
1302
|
-
/*eslint no-param-reassign:0*/
|
1303
|
-
if (!params) {
|
1304
|
-
return url;
|
1305
|
-
}
|
1306
1849
|
|
1307
|
-
|
1308
|
-
|
1309
|
-
|
1310
|
-
|
1311
|
-
|
1312
|
-
|
1313
|
-
var parts = [];
|
1850
|
+
// eslint-disable-next-line consistent-return
|
1851
|
+
function valueFromConfig2(prop) {
|
1852
|
+
if (!utils.isUndefined(config2[prop])) {
|
1853
|
+
return getMergedValue(undefined, config2[prop]);
|
1854
|
+
}
|
1855
|
+
}
|
1314
1856
|
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1857
|
+
// eslint-disable-next-line consistent-return
|
1858
|
+
function defaultToConfig2(prop) {
|
1859
|
+
if (!utils.isUndefined(config2[prop])) {
|
1860
|
+
return getMergedValue(undefined, config2[prop]);
|
1861
|
+
} else if (!utils.isUndefined(config1[prop])) {
|
1862
|
+
return getMergedValue(undefined, config1[prop]);
|
1318
1863
|
}
|
1864
|
+
}
|
1319
1865
|
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1866
|
+
// eslint-disable-next-line consistent-return
|
1867
|
+
function mergeDirectKeys(prop) {
|
1868
|
+
if (prop in config2) {
|
1869
|
+
return getMergedValue(config1[prop], config2[prop]);
|
1870
|
+
} else if (prop in config1) {
|
1871
|
+
return getMergedValue(undefined, config1[prop]);
|
1324
1872
|
}
|
1873
|
+
}
|
1325
1874
|
|
1326
|
-
|
1327
|
-
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1875
|
+
var mergeMap = {
|
1876
|
+
'url': valueFromConfig2,
|
1877
|
+
'method': valueFromConfig2,
|
1878
|
+
'data': valueFromConfig2,
|
1879
|
+
'baseURL': defaultToConfig2,
|
1880
|
+
'transformRequest': defaultToConfig2,
|
1881
|
+
'transformResponse': defaultToConfig2,
|
1882
|
+
'paramsSerializer': defaultToConfig2,
|
1883
|
+
'timeout': defaultToConfig2,
|
1884
|
+
'timeoutMessage': defaultToConfig2,
|
1885
|
+
'withCredentials': defaultToConfig2,
|
1886
|
+
'withXSRFToken': defaultToConfig2,
|
1887
|
+
'adapter': defaultToConfig2,
|
1888
|
+
'responseType': defaultToConfig2,
|
1889
|
+
'xsrfCookieName': defaultToConfig2,
|
1890
|
+
'xsrfHeaderName': defaultToConfig2,
|
1891
|
+
'onUploadProgress': defaultToConfig2,
|
1892
|
+
'onDownloadProgress': defaultToConfig2,
|
1893
|
+
'decompress': defaultToConfig2,
|
1894
|
+
'maxContentLength': defaultToConfig2,
|
1895
|
+
'maxBodyLength': defaultToConfig2,
|
1896
|
+
'beforeRedirect': defaultToConfig2,
|
1897
|
+
'transport': defaultToConfig2,
|
1898
|
+
'httpAgent': defaultToConfig2,
|
1899
|
+
'httpsAgent': defaultToConfig2,
|
1900
|
+
'cancelToken': defaultToConfig2,
|
1901
|
+
'socketPath': defaultToConfig2,
|
1902
|
+
'responseEncoding': defaultToConfig2,
|
1903
|
+
'validateStatus': mergeDirectKeys
|
1904
|
+
};
|
1335
1905
|
|
1336
|
-
|
1337
|
-
|
1906
|
+
utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
|
1907
|
+
var merge = mergeMap[prop] || mergeDeepProperties;
|
1908
|
+
var configValue = merge(prop);
|
1909
|
+
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
1910
|
+
});
|
1338
1911
|
|
1339
|
-
|
1340
|
-
|
1341
|
-
if (hashmarkIndex !== -1) {
|
1342
|
-
url = url.slice(0, hashmarkIndex);
|
1343
|
-
}
|
1912
|
+
return config;
|
1913
|
+
};
|
1344
1914
|
|
1345
|
-
|
1346
|
-
|
1915
|
+
var data = {
|
1916
|
+
"version": "0.30.0"
|
1917
|
+
};
|
1347
1918
|
|
1348
|
-
|
1349
|
-
};
|
1919
|
+
var VERSION = data.version;
|
1350
1920
|
|
1351
1921
|
|
1352
|
-
|
1922
|
+
var validators$1 = {};
|
1353
1923
|
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1924
|
+
// eslint-disable-next-line func-names
|
1925
|
+
['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function(type, i) {
|
1926
|
+
validators$1[type] = function validator(thing) {
|
1927
|
+
return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
|
1928
|
+
};
|
1929
|
+
});
|
1360
1930
|
|
1361
|
-
|
1931
|
+
var deprecatedWarnings = {};
|
1362
1932
|
|
1933
|
+
/**
|
1934
|
+
* Transitional option validator
|
1935
|
+
* @param {function|boolean?} validator - set to false if the transitional option has been removed
|
1936
|
+
* @param {string?} version - deprecated version / removed since version
|
1937
|
+
* @param {string?} message - some message with additional info
|
1938
|
+
* @returns {function}
|
1939
|
+
*/
|
1940
|
+
validators$1.transitional = function transitional(validator, version, message) {
|
1941
|
+
function formatMessage(opt, desc) {
|
1942
|
+
return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
|
1943
|
+
}
|
1363
1944
|
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1372
|
-
return relativeURL
|
1373
|
-
? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
1374
|
-
: baseURL;
|
1375
|
-
};
|
1945
|
+
// eslint-disable-next-line func-names
|
1946
|
+
return function(value, opt, opts) {
|
1947
|
+
if (validator === false) {
|
1948
|
+
throw new AxiosError_1(
|
1949
|
+
formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
|
1950
|
+
AxiosError_1.ERR_DEPRECATED
|
1951
|
+
);
|
1952
|
+
}
|
1376
1953
|
|
1954
|
+
if (version && !deprecatedWarnings[opt]) {
|
1955
|
+
deprecatedWarnings[opt] = true;
|
1956
|
+
// eslint-disable-next-line no-console
|
1957
|
+
console.warn(
|
1958
|
+
formatMessage(
|
1959
|
+
opt,
|
1960
|
+
' has been deprecated since v' + version + ' and will be removed in the near future'
|
1961
|
+
)
|
1962
|
+
);
|
1963
|
+
}
|
1377
1964
|
|
1378
|
-
|
1965
|
+
return validator ? validator(value, opt, opts) : true;
|
1966
|
+
};
|
1967
|
+
};
|
1379
1968
|
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1385
|
-
|
1969
|
+
/**
|
1970
|
+
* Assert object's properties type
|
1971
|
+
* @param {object} options
|
1972
|
+
* @param {object} schema
|
1973
|
+
* @param {boolean?} allowUnknown
|
1974
|
+
*/
|
1386
1975
|
|
1387
|
-
|
1976
|
+
function assertOptions(options, schema, allowUnknown) {
|
1977
|
+
if (typeof options !== 'object') {
|
1978
|
+
throw new AxiosError_1('options must be an object', AxiosError_1.ERR_BAD_OPTION_VALUE);
|
1979
|
+
}
|
1980
|
+
var keys = Object.keys(options);
|
1981
|
+
var i = keys.length;
|
1982
|
+
while (i-- > 0) {
|
1983
|
+
var opt = keys[i];
|
1984
|
+
var validator = schema[opt];
|
1985
|
+
if (validator) {
|
1986
|
+
var value = options[opt];
|
1987
|
+
var result = value === undefined || validator(value, opt, options);
|
1988
|
+
if (result !== true) {
|
1989
|
+
throw new AxiosError_1('option ' + opt + ' must be ' + result, AxiosError_1.ERR_BAD_OPTION_VALUE);
|
1990
|
+
}
|
1991
|
+
continue;
|
1992
|
+
}
|
1993
|
+
if (allowUnknown !== true) {
|
1994
|
+
throw new AxiosError_1('Unknown option ' + opt, AxiosError_1.ERR_BAD_OPTION);
|
1995
|
+
}
|
1996
|
+
}
|
1997
|
+
}
|
1388
1998
|
|
1999
|
+
var validator = {
|
2000
|
+
assertOptions: assertOptions,
|
2001
|
+
validators: validators$1
|
2002
|
+
};
|
1389
2003
|
|
1390
|
-
var
|
2004
|
+
var validators = validator.validators;
|
2005
|
+
/**
|
2006
|
+
* Create a new instance of Axios
|
2007
|
+
*
|
2008
|
+
* @param {Object} instanceConfig The default config for the instance
|
2009
|
+
*/
|
2010
|
+
function Axios(instanceConfig) {
|
2011
|
+
this.defaults = instanceConfig;
|
2012
|
+
this.interceptors = {
|
2013
|
+
request: new InterceptorManager_1(),
|
2014
|
+
response: new InterceptorManager_1()
|
2015
|
+
};
|
2016
|
+
}
|
1391
2017
|
|
1392
|
-
|
1393
|
-
|
2018
|
+
/**
|
2019
|
+
* Dispatch a request
|
2020
|
+
*
|
2021
|
+
* @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
|
2022
|
+
* @param {?Object} config
|
2023
|
+
*/
|
2024
|
+
Axios.prototype.request = function request(configOrUrl, config) {
|
2025
|
+
/*eslint no-param-reassign:0*/
|
2026
|
+
// Allow for axios('example/url'[, config]) a la fetch API
|
2027
|
+
if (typeof configOrUrl === 'string') {
|
2028
|
+
config = config || {};
|
2029
|
+
config.url = configOrUrl;
|
2030
|
+
} else {
|
2031
|
+
config = configOrUrl || {};
|
2032
|
+
}
|
1394
2033
|
|
1395
|
-
|
1396
|
-
(function standardBrowserEnv() {
|
1397
|
-
return {
|
1398
|
-
write: function write(name, value, expires, path, domain, secure) {
|
1399
|
-
var cookie = [];
|
1400
|
-
cookie.push(name + '=' + encodeURIComponent(value));
|
2034
|
+
config = mergeConfig(this.defaults, config);
|
1401
2035
|
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
2036
|
+
// Set config.method
|
2037
|
+
if (config.method) {
|
2038
|
+
config.method = config.method.toLowerCase();
|
2039
|
+
} else if (this.defaults.method) {
|
2040
|
+
config.method = this.defaults.method.toLowerCase();
|
2041
|
+
} else {
|
2042
|
+
config.method = 'get';
|
2043
|
+
}
|
1405
2044
|
|
1406
|
-
|
1407
|
-
cookie.push('path=' + path);
|
1408
|
-
}
|
2045
|
+
var transitional = config.transitional;
|
1409
2046
|
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
2047
|
+
if (transitional !== undefined) {
|
2048
|
+
validator.assertOptions(transitional, {
|
2049
|
+
silentJSONParsing: validators.transitional(validators.boolean),
|
2050
|
+
forcedJSONParsing: validators.transitional(validators.boolean),
|
2051
|
+
clarifyTimeoutError: validators.transitional(validators.boolean)
|
2052
|
+
}, false);
|
2053
|
+
}
|
1413
2054
|
|
1414
|
-
|
1415
|
-
cookie.push('secure');
|
1416
|
-
}
|
2055
|
+
var paramsSerializer = config.paramsSerializer;
|
1417
2056
|
|
1418
|
-
|
1419
|
-
|
2057
|
+
if (paramsSerializer != null) {
|
2058
|
+
if (utils.isFunction(paramsSerializer)) {
|
2059
|
+
config.paramsSerializer = {
|
2060
|
+
serialize: paramsSerializer
|
2061
|
+
};
|
2062
|
+
} else {
|
2063
|
+
validator.assertOptions(paramsSerializer, {
|
2064
|
+
encode: validators.function,
|
2065
|
+
serialize: validators.function
|
2066
|
+
}, true);
|
2067
|
+
}
|
2068
|
+
}
|
1420
2069
|
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
2070
|
+
// filter out skipped interceptors
|
2071
|
+
var requestInterceptorChain = [];
|
2072
|
+
var synchronousRequestInterceptors = true;
|
2073
|
+
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
2074
|
+
if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
|
2075
|
+
return;
|
2076
|
+
}
|
1425
2077
|
|
1426
|
-
|
1427
|
-
this.write(name, '', Date.now() - 86400000);
|
1428
|
-
}
|
1429
|
-
};
|
1430
|
-
})() :
|
2078
|
+
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
1431
2079
|
|
1432
|
-
|
1433
|
-
|
1434
|
-
return {
|
1435
|
-
write: function write() {},
|
1436
|
-
read: function read() { return null; },
|
1437
|
-
remove: function remove() {}
|
1438
|
-
};
|
1439
|
-
})()
|
1440
|
-
);
|
2080
|
+
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
2081
|
+
});
|
1441
2082
|
|
2083
|
+
var responseInterceptorChain = [];
|
2084
|
+
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
2085
|
+
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
2086
|
+
});
|
1442
2087
|
|
1443
|
-
|
2088
|
+
var promise;
|
1444
2089
|
|
1445
|
-
|
1446
|
-
|
1447
|
-
!*** ./lib/helpers/isAbsoluteURL.js ***!
|
1448
|
-
\**************************************/
|
1449
|
-
/*! no static exports found */
|
1450
|
-
/***/ (function(module, exports, __webpack_require__) {
|
2090
|
+
if (!synchronousRequestInterceptors) {
|
2091
|
+
var chain = [dispatchRequest, undefined];
|
1451
2092
|
|
1452
|
-
|
2093
|
+
Array.prototype.unshift.apply(chain, requestInterceptorChain);
|
2094
|
+
chain = chain.concat(responseInterceptorChain);
|
1453
2095
|
|
2096
|
+
promise = Promise.resolve(config);
|
2097
|
+
while (chain.length) {
|
2098
|
+
promise = promise.then(chain.shift(), chain.shift());
|
2099
|
+
}
|
1454
2100
|
|
1455
|
-
|
1456
|
-
|
1457
|
-
*
|
1458
|
-
* @param {string} url The URL to test
|
1459
|
-
* @returns {boolean} True if the specified URL is absolute, otherwise false
|
1460
|
-
*/
|
1461
|
-
module.exports = function isAbsoluteURL(url) {
|
1462
|
-
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
1463
|
-
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
1464
|
-
// by any combination of letters, digits, plus, period, or hyphen.
|
1465
|
-
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
|
1466
|
-
};
|
2101
|
+
return promise;
|
2102
|
+
}
|
1467
2103
|
|
1468
2104
|
|
1469
|
-
|
2105
|
+
var newConfig = config;
|
2106
|
+
while (requestInterceptorChain.length) {
|
2107
|
+
var onFulfilled = requestInterceptorChain.shift();
|
2108
|
+
var onRejected = requestInterceptorChain.shift();
|
2109
|
+
try {
|
2110
|
+
newConfig = onFulfilled(newConfig);
|
2111
|
+
} catch (error) {
|
2112
|
+
onRejected(error);
|
2113
|
+
break;
|
2114
|
+
}
|
2115
|
+
}
|
1470
2116
|
|
1471
|
-
|
1472
|
-
|
1473
|
-
|
1474
|
-
|
1475
|
-
|
1476
|
-
/***/ (function(module, exports, __webpack_require__) {
|
2117
|
+
try {
|
2118
|
+
promise = dispatchRequest(newConfig);
|
2119
|
+
} catch (error) {
|
2120
|
+
return Promise.reject(error);
|
2121
|
+
}
|
1477
2122
|
|
1478
|
-
|
2123
|
+
while (responseInterceptorChain.length) {
|
2124
|
+
promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift());
|
2125
|
+
}
|
1479
2126
|
|
2127
|
+
return promise;
|
2128
|
+
};
|
1480
2129
|
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
1486
|
-
*/
|
1487
|
-
module.exports = function isAxiosError(payload) {
|
1488
|
-
return (typeof payload === 'object') && (payload.isAxiosError === true);
|
1489
|
-
};
|
2130
|
+
Axios.prototype.getUri = function getUri(config) {
|
2131
|
+
config = mergeConfig(this.defaults, config);
|
2132
|
+
var fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
|
2133
|
+
return buildURL(fullPath, config.params, config.paramsSerializer);
|
2134
|
+
};
|
1490
2135
|
|
2136
|
+
// Provide aliases for supported request methods
|
2137
|
+
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
2138
|
+
/*eslint func-names:0*/
|
2139
|
+
Axios.prototype[method] = function(url, config) {
|
2140
|
+
return this.request(mergeConfig(config || {}, {
|
2141
|
+
method: method,
|
2142
|
+
url: url,
|
2143
|
+
data: (config || {}).data
|
2144
|
+
}));
|
2145
|
+
};
|
2146
|
+
});
|
1491
2147
|
|
1492
|
-
|
2148
|
+
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
2149
|
+
/*eslint func-names:0*/
|
2150
|
+
|
2151
|
+
function generateHTTPMethod(isForm) {
|
2152
|
+
return function httpMethod(url, data, config) {
|
2153
|
+
return this.request(mergeConfig(config || {}, {
|
2154
|
+
method: method,
|
2155
|
+
headers: isForm ? {
|
2156
|
+
'Content-Type': 'multipart/form-data'
|
2157
|
+
} : {},
|
2158
|
+
url: url,
|
2159
|
+
data: data
|
2160
|
+
}));
|
2161
|
+
};
|
2162
|
+
}
|
1493
2163
|
|
1494
|
-
|
1495
|
-
/*!****************************************!*\
|
1496
|
-
!*** ./lib/helpers/isURLSameOrigin.js ***!
|
1497
|
-
\****************************************/
|
1498
|
-
/*! no static exports found */
|
1499
|
-
/***/ (function(module, exports, __webpack_require__) {
|
2164
|
+
Axios.prototype[method] = generateHTTPMethod();
|
1500
2165
|
|
1501
|
-
|
2166
|
+
Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
|
2167
|
+
});
|
1502
2168
|
|
2169
|
+
var Axios_1 = Axios;
|
1503
2170
|
|
1504
|
-
|
2171
|
+
/**
|
2172
|
+
* A `CancelToken` is an object that can be used to request cancellation of an operation.
|
2173
|
+
*
|
2174
|
+
* @class
|
2175
|
+
* @param {Function} executor The executor function.
|
2176
|
+
*/
|
2177
|
+
function CancelToken(executor) {
|
2178
|
+
if (typeof executor !== 'function') {
|
2179
|
+
throw new TypeError('executor must be a function.');
|
2180
|
+
}
|
1505
2181
|
|
1506
|
-
|
1507
|
-
utils.isStandardBrowserEnv() ?
|
2182
|
+
var resolvePromise;
|
1508
2183
|
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
var msie = /(msie|trident)/i.test(navigator.userAgent);
|
1513
|
-
var urlParsingNode = document.createElement('a');
|
1514
|
-
var originURL;
|
2184
|
+
this.promise = new Promise(function promiseExecutor(resolve) {
|
2185
|
+
resolvePromise = resolve;
|
2186
|
+
});
|
1515
2187
|
|
1516
|
-
|
1517
|
-
* Parse a URL to discover it's components
|
1518
|
-
*
|
1519
|
-
* @param {String} url The URL to be parsed
|
1520
|
-
* @returns {Object}
|
1521
|
-
*/
|
1522
|
-
function resolveURL(url) {
|
1523
|
-
var href = url;
|
2188
|
+
var token = this;
|
1524
2189
|
|
1525
|
-
|
1526
|
-
|
1527
|
-
|
1528
|
-
href = urlParsingNode.href;
|
1529
|
-
}
|
2190
|
+
// eslint-disable-next-line func-names
|
2191
|
+
this.promise.then(function(cancel) {
|
2192
|
+
if (!token._listeners) return;
|
1530
2193
|
|
1531
|
-
|
2194
|
+
var i = token._listeners.length;
|
1532
2195
|
|
1533
|
-
|
1534
|
-
|
1535
|
-
href: urlParsingNode.href,
|
1536
|
-
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
|
1537
|
-
host: urlParsingNode.host,
|
1538
|
-
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
|
1539
|
-
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
|
1540
|
-
hostname: urlParsingNode.hostname,
|
1541
|
-
port: urlParsingNode.port,
|
1542
|
-
pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
|
1543
|
-
urlParsingNode.pathname :
|
1544
|
-
'/' + urlParsingNode.pathname
|
1545
|
-
};
|
2196
|
+
while (i-- > 0) {
|
2197
|
+
token._listeners[i](cancel);
|
1546
2198
|
}
|
2199
|
+
token._listeners = null;
|
2200
|
+
});
|
1547
2201
|
|
1548
|
-
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1552
|
-
|
1553
|
-
|
1554
|
-
|
1555
|
-
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1559
|
-
parsed.host === originURL.host);
|
2202
|
+
// eslint-disable-next-line func-names
|
2203
|
+
this.promise.then = function(onfulfilled) {
|
2204
|
+
var _resolve;
|
2205
|
+
// eslint-disable-next-line func-names
|
2206
|
+
var promise = new Promise(function(resolve) {
|
2207
|
+
token.subscribe(resolve);
|
2208
|
+
_resolve = resolve;
|
2209
|
+
}).then(onfulfilled);
|
2210
|
+
|
2211
|
+
promise.cancel = function reject() {
|
2212
|
+
token.unsubscribe(_resolve);
|
1560
2213
|
};
|
1561
|
-
})() :
|
1562
2214
|
|
1563
|
-
|
1564
|
-
|
1565
|
-
|
1566
|
-
|
1567
|
-
|
1568
|
-
|
1569
|
-
|
2215
|
+
return promise;
|
2216
|
+
};
|
2217
|
+
|
2218
|
+
executor(function cancel(message, config, request) {
|
2219
|
+
if (token.reason) {
|
2220
|
+
// Cancellation has already been requested
|
2221
|
+
return;
|
2222
|
+
}
|
1570
2223
|
|
2224
|
+
token.reason = new CanceledError_1(message, config, request);
|
2225
|
+
resolvePromise(token.reason);
|
2226
|
+
});
|
2227
|
+
}
|
1571
2228
|
|
1572
|
-
|
2229
|
+
/**
|
2230
|
+
* Throws a `CanceledError` if cancellation has been requested.
|
2231
|
+
*/
|
2232
|
+
CancelToken.prototype.throwIfRequested = function throwIfRequested() {
|
2233
|
+
if (this.reason) {
|
2234
|
+
throw this.reason;
|
2235
|
+
}
|
2236
|
+
};
|
1573
2237
|
|
1574
|
-
|
1575
|
-
|
1576
|
-
|
1577
|
-
\********************************************/
|
1578
|
-
/*! no static exports found */
|
1579
|
-
/***/ (function(module, exports, __webpack_require__) {
|
2238
|
+
/**
|
2239
|
+
* Subscribe to the cancel signal
|
2240
|
+
*/
|
1580
2241
|
|
1581
|
-
|
2242
|
+
CancelToken.prototype.subscribe = function subscribe(listener) {
|
2243
|
+
if (this.reason) {
|
2244
|
+
listener(this.reason);
|
2245
|
+
return;
|
2246
|
+
}
|
1582
2247
|
|
2248
|
+
if (this._listeners) {
|
2249
|
+
this._listeners.push(listener);
|
2250
|
+
} else {
|
2251
|
+
this._listeners = [listener];
|
2252
|
+
}
|
2253
|
+
};
|
1583
2254
|
|
1584
|
-
|
2255
|
+
/**
|
2256
|
+
* Unsubscribe from the cancel signal
|
2257
|
+
*/
|
1585
2258
|
|
1586
|
-
|
1587
|
-
|
1588
|
-
|
1589
|
-
headers[normalizedName] = value;
|
1590
|
-
delete headers[name];
|
2259
|
+
CancelToken.prototype.unsubscribe = function unsubscribe(listener) {
|
2260
|
+
if (!this._listeners) {
|
2261
|
+
return;
|
1591
2262
|
}
|
1592
|
-
|
1593
|
-
|
1594
|
-
|
1595
|
-
|
1596
|
-
/***/ }),
|
1597
|
-
|
1598
|
-
/***/ "./lib/helpers/parseHeaders.js":
|
1599
|
-
/*!*************************************!*\
|
1600
|
-
!*** ./lib/helpers/parseHeaders.js ***!
|
1601
|
-
\*************************************/
|
1602
|
-
/*! no static exports found */
|
1603
|
-
/***/ (function(module, exports, __webpack_require__) {
|
1604
|
-
|
1605
|
-
"use strict";
|
1606
|
-
|
1607
|
-
|
1608
|
-
var utils = __webpack_require__(/*! ./../utils */ "./lib/utils.js");
|
1609
|
-
|
1610
|
-
// Headers whose duplicates are ignored by node
|
1611
|
-
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
1612
|
-
var ignoreDuplicateOf = [
|
1613
|
-
'age', 'authorization', 'content-length', 'content-type', 'etag',
|
1614
|
-
'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
|
1615
|
-
'last-modified', 'location', 'max-forwards', 'proxy-authorization',
|
1616
|
-
'referer', 'retry-after', 'user-agent'
|
1617
|
-
];
|
1618
|
-
|
1619
|
-
/**
|
1620
|
-
* Parse headers into an object
|
1621
|
-
*
|
1622
|
-
* ```
|
1623
|
-
* Date: Wed, 27 Aug 2014 08:58:49 GMT
|
1624
|
-
* Content-Type: application/json
|
1625
|
-
* Connection: keep-alive
|
1626
|
-
* Transfer-Encoding: chunked
|
1627
|
-
* ```
|
1628
|
-
*
|
1629
|
-
* @param {String} headers Headers needing to be parsed
|
1630
|
-
* @returns {Object} Headers parsed into an object
|
1631
|
-
*/
|
1632
|
-
module.exports = function parseHeaders(headers) {
|
1633
|
-
var parsed = {};
|
1634
|
-
var key;
|
1635
|
-
var val;
|
1636
|
-
var i;
|
1637
|
-
|
1638
|
-
if (!headers) { return parsed; }
|
1639
|
-
|
1640
|
-
utils.forEach(headers.split('\n'), function parser(line) {
|
1641
|
-
i = line.indexOf(':');
|
1642
|
-
key = utils.trim(line.substr(0, i)).toLowerCase();
|
1643
|
-
val = utils.trim(line.substr(i + 1));
|
1644
|
-
|
1645
|
-
if (key) {
|
1646
|
-
if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
|
1647
|
-
return;
|
1648
|
-
}
|
1649
|
-
if (key === 'set-cookie') {
|
1650
|
-
parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
|
1651
|
-
} else {
|
1652
|
-
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
1653
|
-
}
|
2263
|
+
var index = this._listeners.indexOf(listener);
|
2264
|
+
if (index !== -1) {
|
2265
|
+
this._listeners.splice(index, 1);
|
1654
2266
|
}
|
1655
|
-
}
|
2267
|
+
};
|
1656
2268
|
|
1657
|
-
|
1658
|
-
|
1659
|
-
|
1660
|
-
|
1661
|
-
|
1662
|
-
|
1663
|
-
|
1664
|
-
|
1665
|
-
|
1666
|
-
|
1667
|
-
|
1668
|
-
|
1669
|
-
|
1670
|
-
"use strict";
|
1671
|
-
|
1672
|
-
|
1673
|
-
/**
|
1674
|
-
* Syntactic sugar for invoking a function and expanding an array for arguments.
|
1675
|
-
*
|
1676
|
-
* Common use case would be to use `Function.prototype.apply`.
|
1677
|
-
*
|
1678
|
-
* ```js
|
1679
|
-
* function f(x, y, z) {}
|
1680
|
-
* var args = [1, 2, 3];
|
1681
|
-
* f.apply(null, args);
|
1682
|
-
* ```
|
1683
|
-
*
|
1684
|
-
* With `spread` this example can be re-written.
|
1685
|
-
*
|
1686
|
-
* ```js
|
1687
|
-
* spread(function(x, y, z) {})([1, 2, 3]);
|
1688
|
-
* ```
|
1689
|
-
*
|
1690
|
-
* @param {Function} callback
|
1691
|
-
* @returns {Function}
|
1692
|
-
*/
|
1693
|
-
module.exports = function spread(callback) {
|
1694
|
-
return function wrap(arr) {
|
1695
|
-
return callback.apply(null, arr);
|
2269
|
+
/**
|
2270
|
+
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
2271
|
+
* cancels the `CancelToken`.
|
2272
|
+
*/
|
2273
|
+
CancelToken.source = function source() {
|
2274
|
+
var cancel;
|
2275
|
+
var token = new CancelToken(function executor(c) {
|
2276
|
+
cancel = c;
|
2277
|
+
});
|
2278
|
+
return {
|
2279
|
+
token: token,
|
2280
|
+
cancel: cancel
|
2281
|
+
};
|
1696
2282
|
};
|
1697
|
-
};
|
1698
2283
|
|
2284
|
+
var CancelToken_1 = CancelToken;
|
1699
2285
|
|
1700
|
-
|
2286
|
+
/**
|
2287
|
+
* Syntactic sugar for invoking a function and expanding an array for arguments.
|
2288
|
+
*
|
2289
|
+
* Common use case would be to use `Function.prototype.apply`.
|
2290
|
+
*
|
2291
|
+
* ```js
|
2292
|
+
* function f(x, y, z) {}
|
2293
|
+
* var args = [1, 2, 3];
|
2294
|
+
* f.apply(null, args);
|
2295
|
+
* ```
|
2296
|
+
*
|
2297
|
+
* With `spread` this example can be re-written.
|
2298
|
+
*
|
2299
|
+
* ```js
|
2300
|
+
* spread(function(x, y, z) {})([1, 2, 3]);
|
2301
|
+
* ```
|
2302
|
+
*
|
2303
|
+
* @param {Function} callback
|
2304
|
+
* @returns {Function}
|
2305
|
+
*/
|
2306
|
+
var spread = function spread(callback) {
|
2307
|
+
return function wrap(arr) {
|
2308
|
+
return callback.apply(null, arr);
|
2309
|
+
};
|
2310
|
+
};
|
1701
2311
|
|
1702
|
-
|
1703
|
-
|
1704
|
-
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
2312
|
+
/**
|
2313
|
+
* Determines whether the payload is an error thrown by Axios
|
2314
|
+
*
|
2315
|
+
* @param {*} payload The value to test
|
2316
|
+
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
2317
|
+
*/
|
2318
|
+
var isAxiosError = function isAxiosError(payload) {
|
2319
|
+
return utils.isObject(payload) && (payload.isAxiosError === true);
|
2320
|
+
};
|
1708
2321
|
|
1709
|
-
|
2322
|
+
/**
|
2323
|
+
* Create an instance of Axios
|
2324
|
+
*
|
2325
|
+
* @param {Object} defaultConfig The default config for the instance
|
2326
|
+
* @return {Axios} A new instance of Axios
|
2327
|
+
*/
|
2328
|
+
function createInstance(defaultConfig) {
|
2329
|
+
var context = new Axios_1(defaultConfig);
|
2330
|
+
var instance = bind(Axios_1.prototype.request, context);
|
1710
2331
|
|
2332
|
+
// Copy axios.prototype to instance
|
2333
|
+
utils.extend(instance, Axios_1.prototype, context);
|
1711
2334
|
|
1712
|
-
|
2335
|
+
// Copy context to instance
|
2336
|
+
utils.extend(instance, context);
|
1713
2337
|
|
1714
|
-
|
2338
|
+
// Factory for creating new instances
|
2339
|
+
instance.create = function create(instanceConfig) {
|
2340
|
+
return createInstance(mergeConfig(defaultConfig, instanceConfig));
|
2341
|
+
};
|
1715
2342
|
|
1716
|
-
|
1717
|
-
['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function(type, i) {
|
1718
|
-
validators[type] = function validator(thing) {
|
1719
|
-
return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
|
1720
|
-
};
|
1721
|
-
});
|
1722
|
-
|
1723
|
-
var deprecatedWarnings = {};
|
1724
|
-
var currentVerArr = pkg.version.split('.');
|
1725
|
-
|
1726
|
-
/**
|
1727
|
-
* Compare package versions
|
1728
|
-
* @param {string} version
|
1729
|
-
* @param {string?} thanVersion
|
1730
|
-
* @returns {boolean}
|
1731
|
-
*/
|
1732
|
-
function isOlderVersion(version, thanVersion) {
|
1733
|
-
var pkgVersionArr = thanVersion ? thanVersion.split('.') : currentVerArr;
|
1734
|
-
var destVer = version.split('.');
|
1735
|
-
for (var i = 0; i < 3; i++) {
|
1736
|
-
if (pkgVersionArr[i] > destVer[i]) {
|
1737
|
-
return true;
|
1738
|
-
} else if (pkgVersionArr[i] < destVer[i]) {
|
1739
|
-
return false;
|
1740
|
-
}
|
1741
|
-
}
|
1742
|
-
return false;
|
1743
|
-
}
|
1744
|
-
|
1745
|
-
/**
|
1746
|
-
* Transitional option validator
|
1747
|
-
* @param {function|boolean?} validator
|
1748
|
-
* @param {string?} version
|
1749
|
-
* @param {string} message
|
1750
|
-
* @returns {function}
|
1751
|
-
*/
|
1752
|
-
validators.transitional = function transitional(validator, version, message) {
|
1753
|
-
var isDeprecated = version && isOlderVersion(version);
|
1754
|
-
|
1755
|
-
function formatMessage(opt, desc) {
|
1756
|
-
return '[Axios v' + pkg.version + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
|
2343
|
+
return instance;
|
1757
2344
|
}
|
1758
2345
|
|
1759
|
-
//
|
1760
|
-
|
1761
|
-
if (validator === false) {
|
1762
|
-
throw new Error(formatMessage(opt, ' has been removed in ' + version));
|
1763
|
-
}
|
2346
|
+
// Create the default instance to be exported
|
2347
|
+
var axios = createInstance(defaults_1);
|
1764
2348
|
|
1765
|
-
|
1766
|
-
|
1767
|
-
|
1768
|
-
|
1769
|
-
|
1770
|
-
|
1771
|
-
|
1772
|
-
|
1773
|
-
|
1774
|
-
|
2349
|
+
// Expose Axios class to allow class inheritance
|
2350
|
+
axios.Axios = Axios_1;
|
2351
|
+
|
2352
|
+
// Expose Cancel & CancelToken
|
2353
|
+
axios.CanceledError = CanceledError_1;
|
2354
|
+
axios.CancelToken = CancelToken_1;
|
2355
|
+
axios.isCancel = isCancel;
|
2356
|
+
axios.VERSION = data.version;
|
2357
|
+
axios.toFormData = toFormData_1;
|
2358
|
+
|
2359
|
+
// Expose AxiosError class
|
2360
|
+
axios.AxiosError = AxiosError_1;
|
1775
2361
|
|
1776
|
-
|
2362
|
+
// alias for CanceledError for backward compatibility
|
2363
|
+
axios.Cancel = axios.CanceledError;
|
2364
|
+
|
2365
|
+
// Expose all/spread
|
2366
|
+
axios.all = function all(promises) {
|
2367
|
+
return Promise.all(promises);
|
1777
2368
|
};
|
1778
|
-
|
1779
|
-
|
1780
|
-
/**
|
1781
|
-
* Assert object's properties type
|
1782
|
-
* @param {object} options
|
1783
|
-
* @param {object} schema
|
1784
|
-
* @param {boolean?} allowUnknown
|
1785
|
-
*/
|
1786
|
-
|
1787
|
-
function assertOptions(options, schema, allowUnknown) {
|
1788
|
-
if (typeof options !== 'object') {
|
1789
|
-
throw new TypeError('options must be an object');
|
1790
|
-
}
|
1791
|
-
var keys = Object.keys(options);
|
1792
|
-
var i = keys.length;
|
1793
|
-
while (i-- > 0) {
|
1794
|
-
var opt = keys[i];
|
1795
|
-
var validator = schema[opt];
|
1796
|
-
if (validator) {
|
1797
|
-
var value = options[opt];
|
1798
|
-
var result = value === undefined || validator(value, opt, options);
|
1799
|
-
if (result !== true) {
|
1800
|
-
throw new TypeError('option ' + opt + ' must be ' + result);
|
1801
|
-
}
|
1802
|
-
continue;
|
1803
|
-
}
|
1804
|
-
if (allowUnknown !== true) {
|
1805
|
-
throw Error('Unknown option ' + opt);
|
1806
|
-
}
|
1807
|
-
}
|
1808
|
-
}
|
1809
|
-
|
1810
|
-
module.exports = {
|
1811
|
-
isOlderVersion: isOlderVersion,
|
1812
|
-
assertOptions: assertOptions,
|
1813
|
-
validators: validators
|
1814
|
-
};
|
1815
|
-
|
1816
|
-
|
1817
|
-
/***/ }),
|
1818
|
-
|
1819
|
-
/***/ "./lib/utils.js":
|
1820
|
-
/*!**********************!*\
|
1821
|
-
!*** ./lib/utils.js ***!
|
1822
|
-
\**********************/
|
1823
|
-
/*! no static exports found */
|
1824
|
-
/***/ (function(module, exports, __webpack_require__) {
|
1825
|
-
|
1826
|
-
"use strict";
|
1827
|
-
|
1828
|
-
|
1829
|
-
var bind = __webpack_require__(/*! ./helpers/bind */ "./lib/helpers/bind.js");
|
1830
|
-
|
1831
|
-
// utils is a library of generic helper functions non-specific to axios
|
1832
|
-
|
1833
|
-
var toString = Object.prototype.toString;
|
1834
|
-
|
1835
|
-
/**
|
1836
|
-
* Determine if a value is an Array
|
1837
|
-
*
|
1838
|
-
* @param {Object} val The value to test
|
1839
|
-
* @returns {boolean} True if value is an Array, otherwise false
|
1840
|
-
*/
|
1841
|
-
function isArray(val) {
|
1842
|
-
return toString.call(val) === '[object Array]';
|
1843
|
-
}
|
1844
|
-
|
1845
|
-
/**
|
1846
|
-
* Determine if a value is undefined
|
1847
|
-
*
|
1848
|
-
* @param {Object} val The value to test
|
1849
|
-
* @returns {boolean} True if the value is undefined, otherwise false
|
1850
|
-
*/
|
1851
|
-
function isUndefined(val) {
|
1852
|
-
return typeof val === 'undefined';
|
1853
|
-
}
|
1854
|
-
|
1855
|
-
/**
|
1856
|
-
* Determine if a value is a Buffer
|
1857
|
-
*
|
1858
|
-
* @param {Object} val The value to test
|
1859
|
-
* @returns {boolean} True if value is a Buffer, otherwise false
|
1860
|
-
*/
|
1861
|
-
function isBuffer(val) {
|
1862
|
-
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
|
1863
|
-
&& typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
|
1864
|
-
}
|
1865
|
-
|
1866
|
-
/**
|
1867
|
-
* Determine if a value is an ArrayBuffer
|
1868
|
-
*
|
1869
|
-
* @param {Object} val The value to test
|
1870
|
-
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
1871
|
-
*/
|
1872
|
-
function isArrayBuffer(val) {
|
1873
|
-
return toString.call(val) === '[object ArrayBuffer]';
|
1874
|
-
}
|
1875
|
-
|
1876
|
-
/**
|
1877
|
-
* Determine if a value is a FormData
|
1878
|
-
*
|
1879
|
-
* @param {Object} val The value to test
|
1880
|
-
* @returns {boolean} True if value is an FormData, otherwise false
|
1881
|
-
*/
|
1882
|
-
function isFormData(val) {
|
1883
|
-
return (typeof FormData !== 'undefined') && (val instanceof FormData);
|
1884
|
-
}
|
1885
|
-
|
1886
|
-
/**
|
1887
|
-
* Determine if a value is a view on an ArrayBuffer
|
1888
|
-
*
|
1889
|
-
* @param {Object} val The value to test
|
1890
|
-
* @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
|
1891
|
-
*/
|
1892
|
-
function isArrayBufferView(val) {
|
1893
|
-
var result;
|
1894
|
-
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
|
1895
|
-
result = ArrayBuffer.isView(val);
|
1896
|
-
} else {
|
1897
|
-
result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
|
1898
|
-
}
|
1899
|
-
return result;
|
1900
|
-
}
|
1901
|
-
|
1902
|
-
/**
|
1903
|
-
* Determine if a value is a String
|
1904
|
-
*
|
1905
|
-
* @param {Object} val The value to test
|
1906
|
-
* @returns {boolean} True if value is a String, otherwise false
|
1907
|
-
*/
|
1908
|
-
function isString(val) {
|
1909
|
-
return typeof val === 'string';
|
1910
|
-
}
|
1911
|
-
|
1912
|
-
/**
|
1913
|
-
* Determine if a value is a Number
|
1914
|
-
*
|
1915
|
-
* @param {Object} val The value to test
|
1916
|
-
* @returns {boolean} True if value is a Number, otherwise false
|
1917
|
-
*/
|
1918
|
-
function isNumber(val) {
|
1919
|
-
return typeof val === 'number';
|
1920
|
-
}
|
1921
|
-
|
1922
|
-
/**
|
1923
|
-
* Determine if a value is an Object
|
1924
|
-
*
|
1925
|
-
* @param {Object} val The value to test
|
1926
|
-
* @returns {boolean} True if value is an Object, otherwise false
|
1927
|
-
*/
|
1928
|
-
function isObject(val) {
|
1929
|
-
return val !== null && typeof val === 'object';
|
1930
|
-
}
|
1931
|
-
|
1932
|
-
/**
|
1933
|
-
* Determine if a value is a plain Object
|
1934
|
-
*
|
1935
|
-
* @param {Object} val The value to test
|
1936
|
-
* @return {boolean} True if value is a plain Object, otherwise false
|
1937
|
-
*/
|
1938
|
-
function isPlainObject(val) {
|
1939
|
-
if (toString.call(val) !== '[object Object]') {
|
1940
|
-
return false;
|
1941
|
-
}
|
2369
|
+
axios.spread = spread;
|
1942
2370
|
|
1943
|
-
|
1944
|
-
|
1945
|
-
}
|
1946
|
-
|
1947
|
-
/**
|
1948
|
-
* Determine if a value is a Date
|
1949
|
-
*
|
1950
|
-
* @param {Object} val The value to test
|
1951
|
-
* @returns {boolean} True if value is a Date, otherwise false
|
1952
|
-
*/
|
1953
|
-
function isDate(val) {
|
1954
|
-
return toString.call(val) === '[object Date]';
|
1955
|
-
}
|
1956
|
-
|
1957
|
-
/**
|
1958
|
-
* Determine if a value is a File
|
1959
|
-
*
|
1960
|
-
* @param {Object} val The value to test
|
1961
|
-
* @returns {boolean} True if value is a File, otherwise false
|
1962
|
-
*/
|
1963
|
-
function isFile(val) {
|
1964
|
-
return toString.call(val) === '[object File]';
|
1965
|
-
}
|
1966
|
-
|
1967
|
-
/**
|
1968
|
-
* Determine if a value is a Blob
|
1969
|
-
*
|
1970
|
-
* @param {Object} val The value to test
|
1971
|
-
* @returns {boolean} True if value is a Blob, otherwise false
|
1972
|
-
*/
|
1973
|
-
function isBlob(val) {
|
1974
|
-
return toString.call(val) === '[object Blob]';
|
1975
|
-
}
|
1976
|
-
|
1977
|
-
/**
|
1978
|
-
* Determine if a value is a Function
|
1979
|
-
*
|
1980
|
-
* @param {Object} val The value to test
|
1981
|
-
* @returns {boolean} True if value is a Function, otherwise false
|
1982
|
-
*/
|
1983
|
-
function isFunction(val) {
|
1984
|
-
return toString.call(val) === '[object Function]';
|
1985
|
-
}
|
1986
|
-
|
1987
|
-
/**
|
1988
|
-
* Determine if a value is a Stream
|
1989
|
-
*
|
1990
|
-
* @param {Object} val The value to test
|
1991
|
-
* @returns {boolean} True if value is a Stream, otherwise false
|
1992
|
-
*/
|
1993
|
-
function isStream(val) {
|
1994
|
-
return isObject(val) && isFunction(val.pipe);
|
1995
|
-
}
|
1996
|
-
|
1997
|
-
/**
|
1998
|
-
* Determine if a value is a URLSearchParams object
|
1999
|
-
*
|
2000
|
-
* @param {Object} val The value to test
|
2001
|
-
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
2002
|
-
*/
|
2003
|
-
function isURLSearchParams(val) {
|
2004
|
-
return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
|
2005
|
-
}
|
2006
|
-
|
2007
|
-
/**
|
2008
|
-
* Trim excess whitespace off the beginning and end of a string
|
2009
|
-
*
|
2010
|
-
* @param {String} str The String to trim
|
2011
|
-
* @returns {String} The String freed of excess whitespace
|
2012
|
-
*/
|
2013
|
-
function trim(str) {
|
2014
|
-
return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, '');
|
2015
|
-
}
|
2016
|
-
|
2017
|
-
/**
|
2018
|
-
* Determine if we're running in a standard browser environment
|
2019
|
-
*
|
2020
|
-
* This allows axios to run in a web worker, and react-native.
|
2021
|
-
* Both environments support XMLHttpRequest, but not fully standard globals.
|
2022
|
-
*
|
2023
|
-
* web workers:
|
2024
|
-
* typeof window -> undefined
|
2025
|
-
* typeof document -> undefined
|
2026
|
-
*
|
2027
|
-
* react-native:
|
2028
|
-
* navigator.product -> 'ReactNative'
|
2029
|
-
* nativescript
|
2030
|
-
* navigator.product -> 'NativeScript' or 'NS'
|
2031
|
-
*/
|
2032
|
-
function isStandardBrowserEnv() {
|
2033
|
-
if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
|
2034
|
-
navigator.product === 'NativeScript' ||
|
2035
|
-
navigator.product === 'NS')) {
|
2036
|
-
return false;
|
2037
|
-
}
|
2038
|
-
return (
|
2039
|
-
typeof window !== 'undefined' &&
|
2040
|
-
typeof document !== 'undefined'
|
2041
|
-
);
|
2042
|
-
}
|
2043
|
-
|
2044
|
-
/**
|
2045
|
-
* Iterate over an Array or an Object invoking a function for each item.
|
2046
|
-
*
|
2047
|
-
* If `obj` is an Array callback will be called passing
|
2048
|
-
* the value, index, and complete array for each item.
|
2049
|
-
*
|
2050
|
-
* If 'obj' is an Object callback will be called passing
|
2051
|
-
* the value, key, and complete object for each property.
|
2052
|
-
*
|
2053
|
-
* @param {Object|Array} obj The object to iterate
|
2054
|
-
* @param {Function} fn The callback to invoke for each item
|
2055
|
-
*/
|
2056
|
-
function forEach(obj, fn) {
|
2057
|
-
// Don't bother if no value provided
|
2058
|
-
if (obj === null || typeof obj === 'undefined') {
|
2059
|
-
return;
|
2060
|
-
}
|
2371
|
+
// Expose isAxiosError
|
2372
|
+
axios.isAxiosError = isAxiosError;
|
2061
2373
|
|
2062
|
-
|
2063
|
-
|
2064
|
-
|
2065
|
-
obj = [obj];
|
2066
|
-
}
|
2374
|
+
axios.formToJSON = function(thing) {
|
2375
|
+
return formDataToJSON_1(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
|
2376
|
+
};
|
2067
2377
|
|
2068
|
-
|
2069
|
-
// Iterate over array values
|
2070
|
-
for (var i = 0, l = obj.length; i < l; i++) {
|
2071
|
-
fn.call(null, obj[i], i, obj);
|
2072
|
-
}
|
2073
|
-
} else {
|
2074
|
-
// Iterate over object keys
|
2075
|
-
for (var key in obj) {
|
2076
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
2077
|
-
fn.call(null, obj[key], key, obj);
|
2078
|
-
}
|
2079
|
-
}
|
2080
|
-
}
|
2081
|
-
}
|
2082
|
-
|
2083
|
-
/**
|
2084
|
-
* Accepts varargs expecting each argument to be an object, then
|
2085
|
-
* immutably merges the properties of each object and returns result.
|
2086
|
-
*
|
2087
|
-
* When multiple objects contain the same key the later object in
|
2088
|
-
* the arguments list will take precedence.
|
2089
|
-
*
|
2090
|
-
* Example:
|
2091
|
-
*
|
2092
|
-
* ```js
|
2093
|
-
* var result = merge({foo: 123}, {foo: 456});
|
2094
|
-
* console.log(result.foo); // outputs 456
|
2095
|
-
* ```
|
2096
|
-
*
|
2097
|
-
* @param {Object} obj1 Object to merge
|
2098
|
-
* @returns {Object} Result of all merge properties
|
2099
|
-
*/
|
2100
|
-
function merge(/* obj1, obj2, obj3, ... */) {
|
2101
|
-
var result = {};
|
2102
|
-
function assignValue(val, key) {
|
2103
|
-
if (isPlainObject(result[key]) && isPlainObject(val)) {
|
2104
|
-
result[key] = merge(result[key], val);
|
2105
|
-
} else if (isPlainObject(val)) {
|
2106
|
-
result[key] = merge({}, val);
|
2107
|
-
} else if (isArray(val)) {
|
2108
|
-
result[key] = val.slice();
|
2109
|
-
} else {
|
2110
|
-
result[key] = val;
|
2111
|
-
}
|
2112
|
-
}
|
2378
|
+
var axios_1 = axios;
|
2113
2379
|
|
2114
|
-
|
2115
|
-
|
2116
|
-
|
2117
|
-
|
2118
|
-
|
2119
|
-
|
2120
|
-
|
2121
|
-
|
2122
|
-
*
|
2123
|
-
* @param {Object} a The object to be extended
|
2124
|
-
* @param {Object} b The object to copy properties from
|
2125
|
-
* @param {Object} thisArg The object to bind function to
|
2126
|
-
* @return {Object} The resulting value of object a
|
2127
|
-
*/
|
2128
|
-
function extend(a, b, thisArg) {
|
2129
|
-
forEach(b, function assignValue(val, key) {
|
2130
|
-
if (thisArg && typeof val === 'function') {
|
2131
|
-
a[key] = bind(val, thisArg);
|
2132
|
-
} else {
|
2133
|
-
a[key] = val;
|
2134
|
-
}
|
2135
|
-
});
|
2136
|
-
return a;
|
2137
|
-
}
|
2138
|
-
|
2139
|
-
/**
|
2140
|
-
* Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
|
2141
|
-
*
|
2142
|
-
* @param {string} content with BOM
|
2143
|
-
* @return {string} content value without BOM
|
2144
|
-
*/
|
2145
|
-
function stripBOM(content) {
|
2146
|
-
if (content.charCodeAt(0) === 0xFEFF) {
|
2147
|
-
content = content.slice(1);
|
2148
|
-
}
|
2149
|
-
return content;
|
2150
|
-
}
|
2151
|
-
|
2152
|
-
module.exports = {
|
2153
|
-
isArray: isArray,
|
2154
|
-
isArrayBuffer: isArrayBuffer,
|
2155
|
-
isBuffer: isBuffer,
|
2156
|
-
isFormData: isFormData,
|
2157
|
-
isArrayBufferView: isArrayBufferView,
|
2158
|
-
isString: isString,
|
2159
|
-
isNumber: isNumber,
|
2160
|
-
isObject: isObject,
|
2161
|
-
isPlainObject: isPlainObject,
|
2162
|
-
isUndefined: isUndefined,
|
2163
|
-
isDate: isDate,
|
2164
|
-
isFile: isFile,
|
2165
|
-
isBlob: isBlob,
|
2166
|
-
isFunction: isFunction,
|
2167
|
-
isStream: isStream,
|
2168
|
-
isURLSearchParams: isURLSearchParams,
|
2169
|
-
isStandardBrowserEnv: isStandardBrowserEnv,
|
2170
|
-
forEach: forEach,
|
2171
|
-
merge: merge,
|
2172
|
-
extend: extend,
|
2173
|
-
trim: trim,
|
2174
|
-
stripBOM: stripBOM
|
2175
|
-
};
|
2176
|
-
|
2177
|
-
|
2178
|
-
/***/ }),
|
2179
|
-
|
2180
|
-
/***/ "./package.json":
|
2181
|
-
/*!**********************!*\
|
2182
|
-
!*** ./package.json ***!
|
2183
|
-
\**********************/
|
2184
|
-
/*! exports provided: name, version, description, main, scripts, repository, keywords, author, license, bugs, homepage, devDependencies, browser, jsdelivr, unpkg, typings, dependencies, bundlesize, default */
|
2185
|
-
/***/ (function(module) {
|
2186
|
-
|
2187
|
-
module.exports = JSON.parse("{\"name\":\"axios\",\"version\":\"0.21.4\",\"description\":\"Promise based HTTP client for the browser and node.js\",\"main\":\"index.js\",\"scripts\":{\"test\":\"grunt test\",\"start\":\"node ./sandbox/server.js\",\"build\":\"NODE_ENV=production grunt build\",\"preversion\":\"npm test\",\"version\":\"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json\",\"postversion\":\"git push && git push --tags\",\"examples\":\"node ./examples/server.js\",\"coveralls\":\"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js\",\"fix\":\"eslint --fix lib/**/*.js\"},\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/axios/axios.git\"},\"keywords\":[\"xhr\",\"http\",\"ajax\",\"promise\",\"node\"],\"author\":\"Matt Zabriskie\",\"license\":\"MIT\",\"bugs\":{\"url\":\"https://github.com/axios/axios/issues\"},\"homepage\":\"https://axios-http.com\",\"devDependencies\":{\"coveralls\":\"^3.0.0\",\"es6-promise\":\"^4.2.4\",\"grunt\":\"^1.3.0\",\"grunt-banner\":\"^0.6.0\",\"grunt-cli\":\"^1.2.0\",\"grunt-contrib-clean\":\"^1.1.0\",\"grunt-contrib-watch\":\"^1.0.0\",\"grunt-eslint\":\"^23.0.0\",\"grunt-karma\":\"^4.0.0\",\"grunt-mocha-test\":\"^0.13.3\",\"grunt-ts\":\"^6.0.0-beta.19\",\"grunt-webpack\":\"^4.0.2\",\"istanbul-instrumenter-loader\":\"^1.0.0\",\"jasmine-core\":\"^2.4.1\",\"karma\":\"^6.3.2\",\"karma-chrome-launcher\":\"^3.1.0\",\"karma-firefox-launcher\":\"^2.1.0\",\"karma-jasmine\":\"^1.1.1\",\"karma-jasmine-ajax\":\"^0.1.13\",\"karma-safari-launcher\":\"^1.0.0\",\"karma-sauce-launcher\":\"^4.3.6\",\"karma-sinon\":\"^1.0.5\",\"karma-sourcemap-loader\":\"^0.3.8\",\"karma-webpack\":\"^4.0.2\",\"load-grunt-tasks\":\"^3.5.2\",\"minimist\":\"^1.2.0\",\"mocha\":\"^8.2.1\",\"sinon\":\"^4.5.0\",\"terser-webpack-plugin\":\"^4.2.3\",\"typescript\":\"^4.0.5\",\"url-search-params\":\"^0.10.0\",\"webpack\":\"^4.44.2\",\"webpack-dev-server\":\"^3.11.0\"},\"browser\":{\"./lib/adapters/http.js\":\"./lib/adapters/xhr.js\"},\"jsdelivr\":\"dist/axios.min.js\",\"unpkg\":\"dist/axios.min.js\",\"typings\":\"./index.d.ts\",\"dependencies\":{\"follow-redirects\":\"^1.14.0\"},\"bundlesize\":[{\"path\":\"./dist/axios.min.js\",\"threshold\":\"5kB\"}]}");
|
2188
|
-
|
2189
|
-
/***/ })
|
2190
|
-
|
2191
|
-
/******/ });
|
2192
|
-
});
|
2193
|
-
//# sourceMappingURL=axios.map
|
2380
|
+
// Allow use of default import syntax in TypeScript
|
2381
|
+
var _default = axios;
|
2382
|
+
axios_1.default = _default;
|
2383
|
+
|
2384
|
+
return axios_1;
|
2385
|
+
|
2386
|
+
}));
|
2387
|
+
//# sourceMappingURL=axios.js.map
|