axios 0.19.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of axios might be problematic. Click here for more details.
- package/CHANGELOG.md +288 -4
- package/README.md +137 -23
- package/dist/axios.js +310 -236
- package/dist/axios.map +1 -1
- package/dist/axios.min.js +2 -8
- package/dist/axios.min.map +1 -1
- package/index.d.ts +18 -10
- package/lib/adapters/http.js +35 -23
- package/lib/adapters/xhr.js +21 -9
- package/lib/core/Axios.js +11 -3
- package/lib/core/buildFullPath.js +20 -0
- package/lib/core/dispatchRequest.js +1 -8
- package/lib/core/enhanceError.js +1 -1
- package/lib/core/mergeConfig.js +59 -23
- package/lib/core/settle.js +1 -1
- package/lib/defaults.js +5 -5
- package/lib/helpers/buildURL.js +0 -1
- package/lib/utils.js +55 -38
- package/package.json +4 -3
package/dist/axios.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/* axios v0.
|
1
|
+
/* axios v0.20.0 | (c) 2020 by Matt Zabriskie */
|
2
2
|
(function webpackUniversalModuleDefinition(root, factory) {
|
3
3
|
if(typeof exports === 'object' && typeof module === 'object')
|
4
4
|
module.exports = factory();
|
@@ -65,9 +65,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
65
65
|
|
66
66
|
var utils = __webpack_require__(2);
|
67
67
|
var bind = __webpack_require__(3);
|
68
|
-
var Axios = __webpack_require__(
|
68
|
+
var Axios = __webpack_require__(4);
|
69
69
|
var mergeConfig = __webpack_require__(22);
|
70
|
-
var defaults = __webpack_require__(
|
70
|
+
var defaults = __webpack_require__(10);
|
71
71
|
|
72
72
|
/**
|
73
73
|
* Create an instance of Axios
|
@@ -102,7 +102,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
102
102
|
// Expose Cancel & CancelToken
|
103
103
|
axios.Cancel = __webpack_require__(23);
|
104
104
|
axios.CancelToken = __webpack_require__(24);
|
105
|
-
axios.isCancel = __webpack_require__(
|
105
|
+
axios.isCancel = __webpack_require__(9);
|
106
106
|
|
107
107
|
// Expose all/spread
|
108
108
|
axios.all = function all(promises) {
|
@@ -123,7 +123,6 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
123
123
|
'use strict';
|
124
124
|
|
125
125
|
var bind = __webpack_require__(3);
|
126
|
-
var isBuffer = __webpack_require__(4);
|
127
126
|
|
128
127
|
/*global toString:true*/
|
129
128
|
|
@@ -141,6 +140,27 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
141
140
|
return toString.call(val) === '[object Array]';
|
142
141
|
}
|
143
142
|
|
143
|
+
/**
|
144
|
+
* Determine if a value is undefined
|
145
|
+
*
|
146
|
+
* @param {Object} val The value to test
|
147
|
+
* @returns {boolean} True if the value is undefined, otherwise false
|
148
|
+
*/
|
149
|
+
function isUndefined(val) {
|
150
|
+
return typeof val === 'undefined';
|
151
|
+
}
|
152
|
+
|
153
|
+
/**
|
154
|
+
* Determine if a value is a Buffer
|
155
|
+
*
|
156
|
+
* @param {Object} val The value to test
|
157
|
+
* @returns {boolean} True if value is a Buffer, otherwise false
|
158
|
+
*/
|
159
|
+
function isBuffer(val) {
|
160
|
+
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
|
161
|
+
&& typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
|
162
|
+
}
|
163
|
+
|
144
164
|
/**
|
145
165
|
* Determine if a value is an ArrayBuffer
|
146
166
|
*
|
@@ -198,23 +218,28 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
198
218
|
}
|
199
219
|
|
200
220
|
/**
|
201
|
-
* Determine if a value is
|
221
|
+
* Determine if a value is an Object
|
202
222
|
*
|
203
223
|
* @param {Object} val The value to test
|
204
|
-
* @returns {boolean} True if
|
224
|
+
* @returns {boolean} True if value is an Object, otherwise false
|
205
225
|
*/
|
206
|
-
function
|
207
|
-
return typeof val === '
|
226
|
+
function isObject(val) {
|
227
|
+
return val !== null && typeof val === 'object';
|
208
228
|
}
|
209
229
|
|
210
230
|
/**
|
211
|
-
* Determine if a value is
|
231
|
+
* Determine if a value is a plain Object
|
212
232
|
*
|
213
233
|
* @param {Object} val The value to test
|
214
|
-
* @
|
234
|
+
* @return {boolean} True if value is a plain Object, otherwise false
|
215
235
|
*/
|
216
|
-
function
|
217
|
-
|
236
|
+
function isPlainObject(val) {
|
237
|
+
if (toString.call(val) !== '[object Object]') {
|
238
|
+
return false;
|
239
|
+
}
|
240
|
+
|
241
|
+
var prototype = Object.getPrototypeOf(val);
|
242
|
+
return prototype === null || prototype === Object.prototype;
|
218
243
|
}
|
219
244
|
|
220
245
|
/**
|
@@ -373,34 +398,12 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
373
398
|
function merge(/* obj1, obj2, obj3, ... */) {
|
374
399
|
var result = {};
|
375
400
|
function assignValue(val, key) {
|
376
|
-
if (
|
401
|
+
if (isPlainObject(result[key]) && isPlainObject(val)) {
|
377
402
|
result[key] = merge(result[key], val);
|
378
|
-
} else {
|
379
|
-
result[key] = val;
|
380
|
-
}
|
381
|
-
|
382
|
-
|
383
|
-
for (var i = 0, l = arguments.length; i < l; i++) {
|
384
|
-
forEach(arguments[i], assignValue);
|
385
|
-
}
|
386
|
-
return result;
|
387
|
-
}
|
388
|
-
|
389
|
-
/**
|
390
|
-
* Function equal to merge with the difference being that no reference
|
391
|
-
* to original objects is kept.
|
392
|
-
*
|
393
|
-
* @see merge
|
394
|
-
* @param {Object} obj1 Object to merge
|
395
|
-
* @returns {Object} Result of all merge properties
|
396
|
-
*/
|
397
|
-
function deepMerge(/* obj1, obj2, obj3, ... */) {
|
398
|
-
var result = {};
|
399
|
-
function assignValue(val, key) {
|
400
|
-
if (typeof result[key] === 'object' && typeof val === 'object') {
|
401
|
-
result[key] = deepMerge(result[key], val);
|
402
|
-
} else if (typeof val === 'object') {
|
403
|
-
result[key] = deepMerge({}, val);
|
403
|
+
} else if (isPlainObject(val)) {
|
404
|
+
result[key] = merge({}, val);
|
405
|
+
} else if (isArray(val)) {
|
406
|
+
result[key] = val.slice();
|
404
407
|
} else {
|
405
408
|
result[key] = val;
|
406
409
|
}
|
@@ -431,6 +434,19 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
431
434
|
return a;
|
432
435
|
}
|
433
436
|
|
437
|
+
/**
|
438
|
+
* Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
|
439
|
+
*
|
440
|
+
* @param {string} content with BOM
|
441
|
+
* @return {string} content value without BOM
|
442
|
+
*/
|
443
|
+
function stripBOM(content) {
|
444
|
+
if (content.charCodeAt(0) === 0xFEFF) {
|
445
|
+
content = content.slice(1);
|
446
|
+
}
|
447
|
+
return content;
|
448
|
+
}
|
449
|
+
|
434
450
|
module.exports = {
|
435
451
|
isArray: isArray,
|
436
452
|
isArrayBuffer: isArrayBuffer,
|
@@ -440,6 +456,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
440
456
|
isString: isString,
|
441
457
|
isNumber: isNumber,
|
442
458
|
isObject: isObject,
|
459
|
+
isPlainObject: isPlainObject,
|
443
460
|
isUndefined: isUndefined,
|
444
461
|
isDate: isDate,
|
445
462
|
isFile: isFile,
|
@@ -450,9 +467,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
450
467
|
isStandardBrowserEnv: isStandardBrowserEnv,
|
451
468
|
forEach: forEach,
|
452
469
|
merge: merge,
|
453
|
-
deepMerge: deepMerge,
|
454
470
|
extend: extend,
|
455
|
-
trim: trim
|
471
|
+
trim: trim,
|
472
|
+
stripBOM: stripBOM
|
456
473
|
};
|
457
474
|
|
458
475
|
|
@@ -475,31 +492,14 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
475
492
|
|
476
493
|
/***/ }),
|
477
494
|
/* 4 */
|
478
|
-
/***/ (function(module, exports) {
|
479
|
-
|
480
|
-
/*!
|
481
|
-
* Determine if an object is a Buffer
|
482
|
-
*
|
483
|
-
* @author Feross Aboukhadijeh <https://feross.org>
|
484
|
-
* @license MIT
|
485
|
-
*/
|
486
|
-
|
487
|
-
module.exports = function isBuffer (obj) {
|
488
|
-
return obj != null && obj.constructor != null &&
|
489
|
-
typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
|
490
|
-
}
|
491
|
-
|
492
|
-
|
493
|
-
/***/ }),
|
494
|
-
/* 5 */
|
495
495
|
/***/ (function(module, exports, __webpack_require__) {
|
496
496
|
|
497
497
|
'use strict';
|
498
498
|
|
499
499
|
var utils = __webpack_require__(2);
|
500
|
-
var buildURL = __webpack_require__(
|
501
|
-
var InterceptorManager = __webpack_require__(
|
502
|
-
var dispatchRequest = __webpack_require__(
|
500
|
+
var buildURL = __webpack_require__(5);
|
501
|
+
var InterceptorManager = __webpack_require__(6);
|
502
|
+
var dispatchRequest = __webpack_require__(7);
|
503
503
|
var mergeConfig = __webpack_require__(22);
|
504
504
|
|
505
505
|
/**
|
@@ -531,7 +531,15 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
531
531
|
}
|
532
532
|
|
533
533
|
config = mergeConfig(this.defaults, config);
|
534
|
-
|
534
|
+
|
535
|
+
// Set config.method
|
536
|
+
if (config.method) {
|
537
|
+
config.method = config.method.toLowerCase();
|
538
|
+
} else if (this.defaults.method) {
|
539
|
+
config.method = this.defaults.method.toLowerCase();
|
540
|
+
} else {
|
541
|
+
config.method = 'get';
|
542
|
+
}
|
535
543
|
|
536
544
|
// Hook up interceptors middleware
|
537
545
|
var chain = [dispatchRequest, undefined];
|
@@ -561,7 +569,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
561
569
|
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
562
570
|
/*eslint func-names:0*/
|
563
571
|
Axios.prototype[method] = function(url, config) {
|
564
|
-
return this.request(
|
572
|
+
return this.request(mergeConfig(config || {}, {
|
565
573
|
method: method,
|
566
574
|
url: url
|
567
575
|
}));
|
@@ -571,7 +579,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
571
579
|
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
572
580
|
/*eslint func-names:0*/
|
573
581
|
Axios.prototype[method] = function(url, data, config) {
|
574
|
-
return this.request(
|
582
|
+
return this.request(mergeConfig(config || {}, {
|
575
583
|
method: method,
|
576
584
|
url: url,
|
577
585
|
data: data
|
@@ -583,7 +591,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
583
591
|
|
584
592
|
|
585
593
|
/***/ }),
|
586
|
-
/*
|
594
|
+
/* 5 */
|
587
595
|
/***/ (function(module, exports, __webpack_require__) {
|
588
596
|
|
589
597
|
'use strict';
|
@@ -592,7 +600,6 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
592
600
|
|
593
601
|
function encode(val) {
|
594
602
|
return encodeURIComponent(val).
|
595
|
-
replace(/%40/gi, '@').
|
596
603
|
replace(/%3A/gi, ':').
|
597
604
|
replace(/%24/g, '$').
|
598
605
|
replace(/%2C/gi, ',').
|
@@ -660,7 +667,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
660
667
|
|
661
668
|
|
662
669
|
/***/ }),
|
663
|
-
/*
|
670
|
+
/* 6 */
|
664
671
|
/***/ (function(module, exports, __webpack_require__) {
|
665
672
|
|
666
673
|
'use strict';
|
@@ -718,17 +725,15 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
718
725
|
|
719
726
|
|
720
727
|
/***/ }),
|
721
|
-
/*
|
728
|
+
/* 7 */
|
722
729
|
/***/ (function(module, exports, __webpack_require__) {
|
723
730
|
|
724
731
|
'use strict';
|
725
732
|
|
726
733
|
var utils = __webpack_require__(2);
|
727
|
-
var transformData = __webpack_require__(
|
728
|
-
var isCancel = __webpack_require__(
|
729
|
-
var defaults = __webpack_require__(
|
730
|
-
var isAbsoluteURL = __webpack_require__(20);
|
731
|
-
var combineURLs = __webpack_require__(21);
|
734
|
+
var transformData = __webpack_require__(8);
|
735
|
+
var isCancel = __webpack_require__(9);
|
736
|
+
var defaults = __webpack_require__(10);
|
732
737
|
|
733
738
|
/**
|
734
739
|
* Throws a `Cancel` if cancellation has been requested.
|
@@ -748,11 +753,6 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
748
753
|
module.exports = function dispatchRequest(config) {
|
749
754
|
throwIfCancellationRequested(config);
|
750
755
|
|
751
|
-
// Support baseURL config
|
752
|
-
if (config.baseURL && !isAbsoluteURL(config.url)) {
|
753
|
-
config.url = combineURLs(config.baseURL, config.url);
|
754
|
-
}
|
755
|
-
|
756
756
|
// Ensure headers exist
|
757
757
|
config.headers = config.headers || {};
|
758
758
|
|
@@ -767,7 +767,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
767
767
|
config.headers = utils.merge(
|
768
768
|
config.headers.common || {},
|
769
769
|
config.headers[config.method] || {},
|
770
|
-
config.headers
|
770
|
+
config.headers
|
771
771
|
);
|
772
772
|
|
773
773
|
utils.forEach(
|
@@ -810,7 +810,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
810
810
|
|
811
811
|
|
812
812
|
/***/ }),
|
813
|
-
/*
|
813
|
+
/* 8 */
|
814
814
|
/***/ (function(module, exports, __webpack_require__) {
|
815
815
|
|
816
816
|
'use strict';
|
@@ -836,7 +836,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
836
836
|
|
837
837
|
|
838
838
|
/***/ }),
|
839
|
-
/*
|
839
|
+
/* 9 */
|
840
840
|
/***/ (function(module, exports) {
|
841
841
|
|
842
842
|
'use strict';
|
@@ -847,13 +847,13 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
847
847
|
|
848
848
|
|
849
849
|
/***/ }),
|
850
|
-
/*
|
850
|
+
/* 10 */
|
851
851
|
/***/ (function(module, exports, __webpack_require__) {
|
852
852
|
|
853
853
|
'use strict';
|
854
854
|
|
855
855
|
var utils = __webpack_require__(2);
|
856
|
-
var normalizeHeaderName = __webpack_require__(
|
856
|
+
var normalizeHeaderName = __webpack_require__(11);
|
857
857
|
|
858
858
|
var DEFAULT_CONTENT_TYPE = {
|
859
859
|
'Content-Type': 'application/x-www-form-urlencoded'
|
@@ -867,13 +867,12 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
867
867
|
|
868
868
|
function getDefaultAdapter() {
|
869
869
|
var adapter;
|
870
|
-
|
871
|
-
if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
|
872
|
-
// For node use HTTP adapter
|
873
|
-
adapter = __webpack_require__(13);
|
874
|
-
} else if (typeof XMLHttpRequest !== 'undefined') {
|
870
|
+
if (typeof XMLHttpRequest !== 'undefined') {
|
875
871
|
// For browsers use XHR adapter
|
876
|
-
adapter = __webpack_require__(
|
872
|
+
adapter = __webpack_require__(12);
|
873
|
+
} else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
|
874
|
+
// For node use HTTP adapter
|
875
|
+
adapter = __webpack_require__(12);
|
877
876
|
}
|
878
877
|
return adapter;
|
879
878
|
}
|
@@ -927,6 +926,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
927
926
|
xsrfHeaderName: 'X-XSRF-TOKEN',
|
928
927
|
|
929
928
|
maxContentLength: -1,
|
929
|
+
maxBodyLength: -1,
|
930
930
|
|
931
931
|
validateStatus: function validateStatus(status) {
|
932
932
|
return status >= 200 && status < 300;
|
@@ -951,7 +951,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
951
951
|
|
952
952
|
|
953
953
|
/***/ }),
|
954
|
-
/*
|
954
|
+
/* 11 */
|
955
955
|
/***/ (function(module, exports, __webpack_require__) {
|
956
956
|
|
957
957
|
'use strict';
|
@@ -969,17 +969,19 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
969
969
|
|
970
970
|
|
971
971
|
/***/ }),
|
972
|
-
/*
|
972
|
+
/* 12 */
|
973
973
|
/***/ (function(module, exports, __webpack_require__) {
|
974
974
|
|
975
975
|
'use strict';
|
976
976
|
|
977
977
|
var utils = __webpack_require__(2);
|
978
|
-
var settle = __webpack_require__(
|
979
|
-
var
|
980
|
-
var
|
981
|
-
var
|
982
|
-
var
|
978
|
+
var settle = __webpack_require__(13);
|
979
|
+
var cookies = __webpack_require__(16);
|
980
|
+
var buildURL = __webpack_require__(5);
|
981
|
+
var buildFullPath = __webpack_require__(17);
|
982
|
+
var parseHeaders = __webpack_require__(20);
|
983
|
+
var isURLSameOrigin = __webpack_require__(21);
|
984
|
+
var createError = __webpack_require__(14);
|
983
985
|
|
984
986
|
module.exports = function xhrAdapter(config) {
|
985
987
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
@@ -990,16 +992,24 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
990
992
|
delete requestHeaders['Content-Type']; // Let the browser set it
|
991
993
|
}
|
992
994
|
|
995
|
+
if (
|
996
|
+
(utils.isBlob(requestData) || utils.isFile(requestData)) &&
|
997
|
+
requestData.type
|
998
|
+
) {
|
999
|
+
delete requestHeaders['Content-Type']; // Let the browser set it
|
1000
|
+
}
|
1001
|
+
|
993
1002
|
var request = new XMLHttpRequest();
|
994
1003
|
|
995
1004
|
// HTTP basic authentication
|
996
1005
|
if (config.auth) {
|
997
1006
|
var username = config.auth.username || '';
|
998
|
-
var password = config.auth.password || '';
|
1007
|
+
var password = unescape(encodeURIComponent(config.auth.password)) || '';
|
999
1008
|
requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
|
1000
1009
|
}
|
1001
1010
|
|
1002
|
-
|
1011
|
+
var fullPath = buildFullPath(config.baseURL, config.url);
|
1012
|
+
request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
|
1003
1013
|
|
1004
1014
|
// Set the request timeout in MS
|
1005
1015
|
request.timeout = config.timeout;
|
@@ -1060,7 +1070,11 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1060
1070
|
|
1061
1071
|
// Handle timeout
|
1062
1072
|
request.ontimeout = function handleTimeout() {
|
1063
|
-
|
1073
|
+
var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
|
1074
|
+
if (config.timeoutErrorMessage) {
|
1075
|
+
timeoutErrorMessage = config.timeoutErrorMessage;
|
1076
|
+
}
|
1077
|
+
reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
|
1064
1078
|
request));
|
1065
1079
|
|
1066
1080
|
// Clean up request
|
@@ -1071,10 +1085,8 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1071
1085
|
// This is only done if running in a standard browser environment.
|
1072
1086
|
// Specifically not if we're in a web worker, or react-native.
|
1073
1087
|
if (utils.isStandardBrowserEnv()) {
|
1074
|
-
var cookies = __webpack_require__(19);
|
1075
|
-
|
1076
1088
|
// Add xsrf header
|
1077
|
-
var xsrfValue = (config.withCredentials || isURLSameOrigin(
|
1089
|
+
var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
|
1078
1090
|
cookies.read(config.xsrfCookieName) :
|
1079
1091
|
undefined;
|
1080
1092
|
|
@@ -1097,8 +1109,8 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1097
1109
|
}
|
1098
1110
|
|
1099
1111
|
// Add withCredentials to request if needed
|
1100
|
-
if (config.withCredentials) {
|
1101
|
-
request.withCredentials =
|
1112
|
+
if (!utils.isUndefined(config.withCredentials)) {
|
1113
|
+
request.withCredentials = !!config.withCredentials;
|
1102
1114
|
}
|
1103
1115
|
|
1104
1116
|
// Add responseType to request if needed
|
@@ -1138,7 +1150,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1138
1150
|
});
|
1139
1151
|
}
|
1140
1152
|
|
1141
|
-
if (requestData
|
1153
|
+
if (!requestData) {
|
1142
1154
|
requestData = null;
|
1143
1155
|
}
|
1144
1156
|
|
@@ -1149,12 +1161,12 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1149
1161
|
|
1150
1162
|
|
1151
1163
|
/***/ }),
|
1152
|
-
/*
|
1164
|
+
/* 13 */
|
1153
1165
|
/***/ (function(module, exports, __webpack_require__) {
|
1154
1166
|
|
1155
1167
|
'use strict';
|
1156
1168
|
|
1157
|
-
var createError = __webpack_require__(
|
1169
|
+
var createError = __webpack_require__(14);
|
1158
1170
|
|
1159
1171
|
/**
|
1160
1172
|
* Resolve or reject a Promise based on response status.
|
@@ -1165,7 +1177,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1165
1177
|
*/
|
1166
1178
|
module.exports = function settle(resolve, reject, response) {
|
1167
1179
|
var validateStatus = response.config.validateStatus;
|
1168
|
-
if (!validateStatus || validateStatus(response.status)) {
|
1180
|
+
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
1169
1181
|
resolve(response);
|
1170
1182
|
} else {
|
1171
1183
|
reject(createError(
|
@@ -1180,12 +1192,12 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1180
1192
|
|
1181
1193
|
|
1182
1194
|
/***/ }),
|
1183
|
-
/*
|
1195
|
+
/* 14 */
|
1184
1196
|
/***/ (function(module, exports, __webpack_require__) {
|
1185
1197
|
|
1186
1198
|
'use strict';
|
1187
1199
|
|
1188
|
-
var enhanceError = __webpack_require__(
|
1200
|
+
var enhanceError = __webpack_require__(15);
|
1189
1201
|
|
1190
1202
|
/**
|
1191
1203
|
* Create an Error with the specified message, config, error code, request and response.
|
@@ -1204,7 +1216,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1204
1216
|
|
1205
1217
|
|
1206
1218
|
/***/ }),
|
1207
|
-
/*
|
1219
|
+
/* 15 */
|
1208
1220
|
/***/ (function(module, exports) {
|
1209
1221
|
|
1210
1222
|
'use strict';
|
@@ -1229,7 +1241,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1229
1241
|
error.response = response;
|
1230
1242
|
error.isAxiosError = true;
|
1231
1243
|
|
1232
|
-
error.toJSON = function() {
|
1244
|
+
error.toJSON = function toJSON() {
|
1233
1245
|
return {
|
1234
1246
|
// Standard
|
1235
1247
|
message: this.message,
|
@@ -1251,12 +1263,137 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1251
1263
|
};
|
1252
1264
|
|
1253
1265
|
|
1266
|
+
/***/ }),
|
1267
|
+
/* 16 */
|
1268
|
+
/***/ (function(module, exports, __webpack_require__) {
|
1269
|
+
|
1270
|
+
'use strict';
|
1271
|
+
|
1272
|
+
var utils = __webpack_require__(2);
|
1273
|
+
|
1274
|
+
module.exports = (
|
1275
|
+
utils.isStandardBrowserEnv() ?
|
1276
|
+
|
1277
|
+
// Standard browser envs support document.cookie
|
1278
|
+
(function standardBrowserEnv() {
|
1279
|
+
return {
|
1280
|
+
write: function write(name, value, expires, path, domain, secure) {
|
1281
|
+
var cookie = [];
|
1282
|
+
cookie.push(name + '=' + encodeURIComponent(value));
|
1283
|
+
|
1284
|
+
if (utils.isNumber(expires)) {
|
1285
|
+
cookie.push('expires=' + new Date(expires).toGMTString());
|
1286
|
+
}
|
1287
|
+
|
1288
|
+
if (utils.isString(path)) {
|
1289
|
+
cookie.push('path=' + path);
|
1290
|
+
}
|
1291
|
+
|
1292
|
+
if (utils.isString(domain)) {
|
1293
|
+
cookie.push('domain=' + domain);
|
1294
|
+
}
|
1295
|
+
|
1296
|
+
if (secure === true) {
|
1297
|
+
cookie.push('secure');
|
1298
|
+
}
|
1299
|
+
|
1300
|
+
document.cookie = cookie.join('; ');
|
1301
|
+
},
|
1302
|
+
|
1303
|
+
read: function read(name) {
|
1304
|
+
var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
1305
|
+
return (match ? decodeURIComponent(match[3]) : null);
|
1306
|
+
},
|
1307
|
+
|
1308
|
+
remove: function remove(name) {
|
1309
|
+
this.write(name, '', Date.now() - 86400000);
|
1310
|
+
}
|
1311
|
+
};
|
1312
|
+
})() :
|
1313
|
+
|
1314
|
+
// Non standard browser env (web workers, react-native) lack needed support.
|
1315
|
+
(function nonStandardBrowserEnv() {
|
1316
|
+
return {
|
1317
|
+
write: function write() {},
|
1318
|
+
read: function read() { return null; },
|
1319
|
+
remove: function remove() {}
|
1320
|
+
};
|
1321
|
+
})()
|
1322
|
+
);
|
1323
|
+
|
1324
|
+
|
1254
1325
|
/***/ }),
|
1255
1326
|
/* 17 */
|
1256
1327
|
/***/ (function(module, exports, __webpack_require__) {
|
1257
1328
|
|
1258
1329
|
'use strict';
|
1259
1330
|
|
1331
|
+
var isAbsoluteURL = __webpack_require__(18);
|
1332
|
+
var combineURLs = __webpack_require__(19);
|
1333
|
+
|
1334
|
+
/**
|
1335
|
+
* Creates a new URL by combining the baseURL with the requestedURL,
|
1336
|
+
* only when the requestedURL is not already an absolute URL.
|
1337
|
+
* If the requestURL is absolute, this function returns the requestedURL untouched.
|
1338
|
+
*
|
1339
|
+
* @param {string} baseURL The base URL
|
1340
|
+
* @param {string} requestedURL Absolute or relative URL to combine
|
1341
|
+
* @returns {string} The combined full path
|
1342
|
+
*/
|
1343
|
+
module.exports = function buildFullPath(baseURL, requestedURL) {
|
1344
|
+
if (baseURL && !isAbsoluteURL(requestedURL)) {
|
1345
|
+
return combineURLs(baseURL, requestedURL);
|
1346
|
+
}
|
1347
|
+
return requestedURL;
|
1348
|
+
};
|
1349
|
+
|
1350
|
+
|
1351
|
+
/***/ }),
|
1352
|
+
/* 18 */
|
1353
|
+
/***/ (function(module, exports) {
|
1354
|
+
|
1355
|
+
'use strict';
|
1356
|
+
|
1357
|
+
/**
|
1358
|
+
* Determines whether the specified URL is absolute
|
1359
|
+
*
|
1360
|
+
* @param {string} url The URL to test
|
1361
|
+
* @returns {boolean} True if the specified URL is absolute, otherwise false
|
1362
|
+
*/
|
1363
|
+
module.exports = function isAbsoluteURL(url) {
|
1364
|
+
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
1365
|
+
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
1366
|
+
// by any combination of letters, digits, plus, period, or hyphen.
|
1367
|
+
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
|
1368
|
+
};
|
1369
|
+
|
1370
|
+
|
1371
|
+
/***/ }),
|
1372
|
+
/* 19 */
|
1373
|
+
/***/ (function(module, exports) {
|
1374
|
+
|
1375
|
+
'use strict';
|
1376
|
+
|
1377
|
+
/**
|
1378
|
+
* Creates a new URL by combining the specified URLs
|
1379
|
+
*
|
1380
|
+
* @param {string} baseURL The base URL
|
1381
|
+
* @param {string} relativeURL The relative URL
|
1382
|
+
* @returns {string} The combined URL
|
1383
|
+
*/
|
1384
|
+
module.exports = function combineURLs(baseURL, relativeURL) {
|
1385
|
+
return relativeURL
|
1386
|
+
? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
1387
|
+
: baseURL;
|
1388
|
+
};
|
1389
|
+
|
1390
|
+
|
1391
|
+
/***/ }),
|
1392
|
+
/* 20 */
|
1393
|
+
/***/ (function(module, exports, __webpack_require__) {
|
1394
|
+
|
1395
|
+
'use strict';
|
1396
|
+
|
1260
1397
|
var utils = __webpack_require__(2);
|
1261
1398
|
|
1262
1399
|
// Headers whose duplicates are ignored by node
|
@@ -1311,7 +1448,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1311
1448
|
|
1312
1449
|
|
1313
1450
|
/***/ }),
|
1314
|
-
/*
|
1451
|
+
/* 21 */
|
1315
1452
|
/***/ (function(module, exports, __webpack_require__) {
|
1316
1453
|
|
1317
1454
|
'use strict';
|
@@ -1384,105 +1521,6 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1384
1521
|
);
|
1385
1522
|
|
1386
1523
|
|
1387
|
-
/***/ }),
|
1388
|
-
/* 19 */
|
1389
|
-
/***/ (function(module, exports, __webpack_require__) {
|
1390
|
-
|
1391
|
-
'use strict';
|
1392
|
-
|
1393
|
-
var utils = __webpack_require__(2);
|
1394
|
-
|
1395
|
-
module.exports = (
|
1396
|
-
utils.isStandardBrowserEnv() ?
|
1397
|
-
|
1398
|
-
// Standard browser envs support document.cookie
|
1399
|
-
(function standardBrowserEnv() {
|
1400
|
-
return {
|
1401
|
-
write: function write(name, value, expires, path, domain, secure) {
|
1402
|
-
var cookie = [];
|
1403
|
-
cookie.push(name + '=' + encodeURIComponent(value));
|
1404
|
-
|
1405
|
-
if (utils.isNumber(expires)) {
|
1406
|
-
cookie.push('expires=' + new Date(expires).toGMTString());
|
1407
|
-
}
|
1408
|
-
|
1409
|
-
if (utils.isString(path)) {
|
1410
|
-
cookie.push('path=' + path);
|
1411
|
-
}
|
1412
|
-
|
1413
|
-
if (utils.isString(domain)) {
|
1414
|
-
cookie.push('domain=' + domain);
|
1415
|
-
}
|
1416
|
-
|
1417
|
-
if (secure === true) {
|
1418
|
-
cookie.push('secure');
|
1419
|
-
}
|
1420
|
-
|
1421
|
-
document.cookie = cookie.join('; ');
|
1422
|
-
},
|
1423
|
-
|
1424
|
-
read: function read(name) {
|
1425
|
-
var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
1426
|
-
return (match ? decodeURIComponent(match[3]) : null);
|
1427
|
-
},
|
1428
|
-
|
1429
|
-
remove: function remove(name) {
|
1430
|
-
this.write(name, '', Date.now() - 86400000);
|
1431
|
-
}
|
1432
|
-
};
|
1433
|
-
})() :
|
1434
|
-
|
1435
|
-
// Non standard browser env (web workers, react-native) lack needed support.
|
1436
|
-
(function nonStandardBrowserEnv() {
|
1437
|
-
return {
|
1438
|
-
write: function write() {},
|
1439
|
-
read: function read() { return null; },
|
1440
|
-
remove: function remove() {}
|
1441
|
-
};
|
1442
|
-
})()
|
1443
|
-
);
|
1444
|
-
|
1445
|
-
|
1446
|
-
/***/ }),
|
1447
|
-
/* 20 */
|
1448
|
-
/***/ (function(module, exports) {
|
1449
|
-
|
1450
|
-
'use strict';
|
1451
|
-
|
1452
|
-
/**
|
1453
|
-
* Determines whether the specified URL is absolute
|
1454
|
-
*
|
1455
|
-
* @param {string} url The URL to test
|
1456
|
-
* @returns {boolean} True if the specified URL is absolute, otherwise false
|
1457
|
-
*/
|
1458
|
-
module.exports = function isAbsoluteURL(url) {
|
1459
|
-
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
1460
|
-
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
1461
|
-
// by any combination of letters, digits, plus, period, or hyphen.
|
1462
|
-
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
|
1463
|
-
};
|
1464
|
-
|
1465
|
-
|
1466
|
-
/***/ }),
|
1467
|
-
/* 21 */
|
1468
|
-
/***/ (function(module, exports) {
|
1469
|
-
|
1470
|
-
'use strict';
|
1471
|
-
|
1472
|
-
/**
|
1473
|
-
* Creates a new URL by combining the specified URLs
|
1474
|
-
*
|
1475
|
-
* @param {string} baseURL The base URL
|
1476
|
-
* @param {string} relativeURL The relative URL
|
1477
|
-
* @returns {string} The combined URL
|
1478
|
-
*/
|
1479
|
-
module.exports = function combineURLs(baseURL, relativeURL) {
|
1480
|
-
return relativeURL
|
1481
|
-
? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
1482
|
-
: baseURL;
|
1483
|
-
};
|
1484
|
-
|
1485
|
-
|
1486
1524
|
/***/ }),
|
1487
1525
|
/* 22 */
|
1488
1526
|
/***/ (function(module, exports, __webpack_require__) {
|
@@ -1504,38 +1542,74 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1504
1542
|
config2 = config2 || {};
|
1505
1543
|
var config = {};
|
1506
1544
|
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1545
|
+
var valueFromConfig2Keys = ['url', 'method', 'data'];
|
1546
|
+
var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params'];
|
1547
|
+
var defaultToConfig2Keys = [
|
1548
|
+
'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',
|
1549
|
+
'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
|
1550
|
+
'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress',
|
1551
|
+
'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent',
|
1552
|
+
'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding'
|
1553
|
+
];
|
1554
|
+
var directMergeKeys = ['validateStatus'];
|
1555
|
+
|
1556
|
+
function getMergedValue(target, source) {
|
1557
|
+
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
1558
|
+
return utils.merge(target, source);
|
1559
|
+
} else if (utils.isPlainObject(source)) {
|
1560
|
+
return utils.merge({}, source);
|
1561
|
+
} else if (utils.isArray(source)) {
|
1562
|
+
return source.slice();
|
1563
|
+
}
|
1564
|
+
return source;
|
1565
|
+
}
|
1566
|
+
|
1567
|
+
function mergeDeepProperties(prop) {
|
1568
|
+
if (!utils.isUndefined(config2[prop])) {
|
1569
|
+
config[prop] = getMergedValue(config1[prop], config2[prop]);
|
1570
|
+
} else if (!utils.isUndefined(config1[prop])) {
|
1571
|
+
config[prop] = getMergedValue(undefined, config1[prop]);
|
1572
|
+
}
|
1573
|
+
}
|
1574
|
+
|
1575
|
+
utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
|
1576
|
+
if (!utils.isUndefined(config2[prop])) {
|
1577
|
+
config[prop] = getMergedValue(undefined, config2[prop]);
|
1510
1578
|
}
|
1511
1579
|
});
|
1512
1580
|
|
1513
|
-
utils.forEach(
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
1517
|
-
config[prop] = config2[prop];
|
1518
|
-
} else if (utils.
|
1519
|
-
config[prop] =
|
1520
|
-
} else if (typeof config1[prop] !== 'undefined') {
|
1521
|
-
config[prop] = config1[prop];
|
1581
|
+
utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);
|
1582
|
+
|
1583
|
+
utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
|
1584
|
+
if (!utils.isUndefined(config2[prop])) {
|
1585
|
+
config[prop] = getMergedValue(undefined, config2[prop]);
|
1586
|
+
} else if (!utils.isUndefined(config1[prop])) {
|
1587
|
+
config[prop] = getMergedValue(undefined, config1[prop]);
|
1522
1588
|
}
|
1523
1589
|
});
|
1524
1590
|
|
1525
|
-
utils.forEach(
|
1526
|
-
|
1527
|
-
|
1528
|
-
|
1529
|
-
|
1530
|
-
'socketPath'
|
1531
|
-
], function defaultToConfig2(prop) {
|
1532
|
-
if (typeof config2[prop] !== 'undefined') {
|
1533
|
-
config[prop] = config2[prop];
|
1534
|
-
} else if (typeof config1[prop] !== 'undefined') {
|
1535
|
-
config[prop] = config1[prop];
|
1591
|
+
utils.forEach(directMergeKeys, function merge(prop) {
|
1592
|
+
if (prop in config2) {
|
1593
|
+
config[prop] = getMergedValue(config1[prop], config2[prop]);
|
1594
|
+
} else if (prop in config1) {
|
1595
|
+
config[prop] = getMergedValue(undefined, config1[prop]);
|
1536
1596
|
}
|
1537
1597
|
});
|
1538
1598
|
|
1599
|
+
var axiosKeys = valueFromConfig2Keys
|
1600
|
+
.concat(mergeDeepPropertiesKeys)
|
1601
|
+
.concat(defaultToConfig2Keys)
|
1602
|
+
.concat(directMergeKeys);
|
1603
|
+
|
1604
|
+
var otherKeys = Object
|
1605
|
+
.keys(config1)
|
1606
|
+
.concat(Object.keys(config2))
|
1607
|
+
.filter(function filterAxiosKeys(key) {
|
1608
|
+
return axiosKeys.indexOf(key) === -1;
|
1609
|
+
});
|
1610
|
+
|
1611
|
+
utils.forEach(otherKeys, mergeDeepProperties);
|
1612
|
+
|
1539
1613
|
return config;
|
1540
1614
|
};
|
1541
1615
|
|