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