@kontent-ai/core-sdk 10.12.3 → 10.12.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/sdk-info.generated.js +1 -1
- package/dist/es6/sdk-info.generated.js +1 -1
- package/dist/esnext/sdk-info.generated.js +1 -1
- package/dist/umd/kontent-core.umd.js +1162 -862
- package/dist/umd/kontent-core.umd.js.map +1 -1
- package/dist/umd/kontent-core.umd.min.js +1 -1
- package/dist/umd/kontent-core.umd.min.js.LICENSE.txt +1 -1
- package/dist/umd/kontent-core.umd.min.js.map +1 -1
- package/dist/umd/report.json +1 -1
- package/dist/umd/report.min.json +1 -1
- package/dist/umd/stats.json +438 -438
- package/dist/umd/stats.min.json +446 -446
- package/lib/sdk-info.generated.ts +1 -1
- package/package.json +18 -18
|
@@ -12,11 +12,11 @@ return /******/ (() => { // webpackBootstrap
|
|
|
12
12
|
/******/ "use strict";
|
|
13
13
|
/******/ var __webpack_modules__ = ({
|
|
14
14
|
|
|
15
|
-
/***/ "./lib/helpers/header.helper.ts"
|
|
15
|
+
/***/ "./lib/helpers/header.helper.ts"
|
|
16
16
|
/*!**************************************!*\
|
|
17
17
|
!*** ./lib/helpers/header.helper.ts ***!
|
|
18
18
|
\**************************************/
|
|
19
|
-
|
|
19
|
+
(__unused_webpack_module, exports) {
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
@@ -42,13 +42,13 @@ exports.HeaderHelper = HeaderHelper;
|
|
|
42
42
|
exports.headerHelper = new HeaderHelper();
|
|
43
43
|
|
|
44
44
|
|
|
45
|
-
/***/ }
|
|
45
|
+
/***/ },
|
|
46
46
|
|
|
47
|
-
/***/ "./lib/helpers/headers-helper.ts"
|
|
47
|
+
/***/ "./lib/helpers/headers-helper.ts"
|
|
48
48
|
/*!***************************************!*\
|
|
49
49
|
!*** ./lib/helpers/headers-helper.ts ***!
|
|
50
50
|
\***************************************/
|
|
51
|
-
|
|
51
|
+
(__unused_webpack_module, exports) {
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
@@ -66,13 +66,13 @@ function extractHeadersFromAxiosResponse(response) {
|
|
|
66
66
|
exports.extractHeadersFromAxiosResponse = extractHeadersFromAxiosResponse;
|
|
67
67
|
|
|
68
68
|
|
|
69
|
-
/***/ }
|
|
69
|
+
/***/ },
|
|
70
70
|
|
|
71
|
-
/***/ "./lib/helpers/index.ts"
|
|
71
|
+
/***/ "./lib/helpers/index.ts"
|
|
72
72
|
/*!******************************!*\
|
|
73
73
|
!*** ./lib/helpers/index.ts ***!
|
|
74
74
|
\******************************/
|
|
75
|
-
|
|
75
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
76
76
|
|
|
77
77
|
|
|
78
78
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
@@ -96,13 +96,13 @@ __exportStar(__webpack_require__(/*! ./retry-helper */ "./lib/helpers/retry-help
|
|
|
96
96
|
__exportStar(__webpack_require__(/*! ./headers-helper */ "./lib/helpers/headers-helper.ts"), exports);
|
|
97
97
|
|
|
98
98
|
|
|
99
|
-
/***/ }
|
|
99
|
+
/***/ },
|
|
100
100
|
|
|
101
|
-
/***/ "./lib/helpers/retry-helper.ts"
|
|
101
|
+
/***/ "./lib/helpers/retry-helper.ts"
|
|
102
102
|
/*!*************************************!*\
|
|
103
103
|
!*** ./lib/helpers/retry-helper.ts ***!
|
|
104
104
|
\*************************************/
|
|
105
|
-
|
|
105
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
106
106
|
|
|
107
107
|
|
|
108
108
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
@@ -254,13 +254,13 @@ exports.RetryHelper = RetryHelper;
|
|
|
254
254
|
exports.retryHelper = new RetryHelper();
|
|
255
255
|
|
|
256
256
|
|
|
257
|
-
/***/ }
|
|
257
|
+
/***/ },
|
|
258
258
|
|
|
259
|
-
/***/ "./lib/helpers/url.helper.ts"
|
|
259
|
+
/***/ "./lib/helpers/url.helper.ts"
|
|
260
260
|
/*!***********************************!*\
|
|
261
261
|
!*** ./lib/helpers/url.helper.ts ***!
|
|
262
262
|
\***********************************/
|
|
263
|
-
|
|
263
|
+
(__unused_webpack_module, exports) {
|
|
264
264
|
|
|
265
265
|
|
|
266
266
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
@@ -290,13 +290,13 @@ exports.UrlHelper = UrlHelper;
|
|
|
290
290
|
exports.urlHelper = new UrlHelper();
|
|
291
291
|
|
|
292
292
|
|
|
293
|
-
/***/ }
|
|
293
|
+
/***/ },
|
|
294
294
|
|
|
295
|
-
/***/ "./lib/http/http.debugger.ts"
|
|
295
|
+
/***/ "./lib/http/http.debugger.ts"
|
|
296
296
|
/*!***********************************!*\
|
|
297
297
|
!*** ./lib/http/http.debugger.ts ***!
|
|
298
298
|
\***********************************/
|
|
299
|
-
|
|
299
|
+
(__unused_webpack_module, exports) {
|
|
300
300
|
|
|
301
301
|
|
|
302
302
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
@@ -322,13 +322,13 @@ exports.HttpDebugger = HttpDebugger;
|
|
|
322
322
|
exports.httpDebugger = new HttpDebugger();
|
|
323
323
|
|
|
324
324
|
|
|
325
|
-
/***/ }
|
|
325
|
+
/***/ },
|
|
326
326
|
|
|
327
|
-
/***/ "./lib/http/http.functions.ts"
|
|
327
|
+
/***/ "./lib/http/http.functions.ts"
|
|
328
328
|
/*!************************************!*\
|
|
329
329
|
!*** ./lib/http/http.functions.ts ***!
|
|
330
330
|
\************************************/
|
|
331
|
-
|
|
331
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
332
332
|
|
|
333
333
|
|
|
334
334
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
@@ -594,25 +594,25 @@ function getHeadersJson(headers, addContentTypeHeader) {
|
|
|
594
594
|
}
|
|
595
595
|
|
|
596
596
|
|
|
597
|
-
/***/ }
|
|
597
|
+
/***/ },
|
|
598
598
|
|
|
599
|
-
/***/ "./lib/http/http.models.ts"
|
|
599
|
+
/***/ "./lib/http/http.models.ts"
|
|
600
600
|
/*!*********************************!*\
|
|
601
601
|
!*** ./lib/http/http.models.ts ***!
|
|
602
602
|
\*********************************/
|
|
603
|
-
|
|
603
|
+
(__unused_webpack_module, exports) {
|
|
604
604
|
|
|
605
605
|
|
|
606
606
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
607
607
|
|
|
608
608
|
|
|
609
|
-
/***/ }
|
|
609
|
+
/***/ },
|
|
610
610
|
|
|
611
|
-
/***/ "./lib/http/http.service.ts"
|
|
611
|
+
/***/ "./lib/http/http.service.ts"
|
|
612
612
|
/*!**********************************!*\
|
|
613
613
|
!*** ./lib/http/http.service.ts ***!
|
|
614
614
|
\**********************************/
|
|
615
|
-
|
|
615
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
616
616
|
|
|
617
617
|
|
|
618
618
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
@@ -672,25 +672,25 @@ class HttpService {
|
|
|
672
672
|
exports.HttpService = HttpService;
|
|
673
673
|
|
|
674
674
|
|
|
675
|
-
/***/ }
|
|
675
|
+
/***/ },
|
|
676
676
|
|
|
677
|
-
/***/ "./lib/http/ihttp.service.ts"
|
|
677
|
+
/***/ "./lib/http/ihttp.service.ts"
|
|
678
678
|
/*!***********************************!*\
|
|
679
679
|
!*** ./lib/http/ihttp.service.ts ***!
|
|
680
680
|
\***********************************/
|
|
681
|
-
|
|
681
|
+
(__unused_webpack_module, exports) {
|
|
682
682
|
|
|
683
683
|
|
|
684
684
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
685
685
|
|
|
686
686
|
|
|
687
|
-
/***/ }
|
|
687
|
+
/***/ },
|
|
688
688
|
|
|
689
|
-
/***/ "./lib/http/index.ts"
|
|
689
|
+
/***/ "./lib/http/index.ts"
|
|
690
690
|
/*!***************************!*\
|
|
691
691
|
!*** ./lib/http/index.ts ***!
|
|
692
692
|
\***************************/
|
|
693
|
-
|
|
693
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
694
694
|
|
|
695
695
|
|
|
696
696
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
@@ -716,13 +716,13 @@ __exportStar(__webpack_require__(/*! ./http.debugger */ "./lib/http/http.debugge
|
|
|
716
716
|
__exportStar(__webpack_require__(/*! ./test-http.service */ "./lib/http/test-http.service.ts"), exports);
|
|
717
717
|
|
|
718
718
|
|
|
719
|
-
/***/ }
|
|
719
|
+
/***/ },
|
|
720
720
|
|
|
721
|
-
/***/ "./lib/http/test-http.service.ts"
|
|
721
|
+
/***/ "./lib/http/test-http.service.ts"
|
|
722
722
|
/*!***************************************!*\
|
|
723
723
|
!*** ./lib/http/test-http.service.ts ***!
|
|
724
724
|
\***************************************/
|
|
725
|
-
|
|
725
|
+
(__unused_webpack_module, exports) {
|
|
726
726
|
|
|
727
727
|
|
|
728
728
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
@@ -770,13 +770,13 @@ class TestHttpService {
|
|
|
770
770
|
exports.TestHttpService = TestHttpService;
|
|
771
771
|
|
|
772
772
|
|
|
773
|
-
/***/ }
|
|
773
|
+
/***/ },
|
|
774
774
|
|
|
775
|
-
/***/ "./lib/index.ts"
|
|
775
|
+
/***/ "./lib/index.ts"
|
|
776
776
|
/*!**********************!*\
|
|
777
777
|
!*** ./lib/index.ts ***!
|
|
778
778
|
\**********************/
|
|
779
|
-
|
|
779
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
780
780
|
|
|
781
781
|
|
|
782
782
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
@@ -800,13 +800,13 @@ __exportStar(__webpack_require__(/*! ./models */ "./lib/models/index.ts"), expor
|
|
|
800
800
|
__exportStar(__webpack_require__(/*! ./http */ "./lib/http/index.ts"), exports);
|
|
801
801
|
|
|
802
802
|
|
|
803
|
-
/***/ }
|
|
803
|
+
/***/ },
|
|
804
804
|
|
|
805
|
-
/***/ "./lib/models/index.ts"
|
|
805
|
+
/***/ "./lib/models/index.ts"
|
|
806
806
|
/*!*****************************!*\
|
|
807
807
|
!*** ./lib/models/index.ts ***!
|
|
808
808
|
\*****************************/
|
|
809
|
-
|
|
809
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
810
810
|
|
|
811
811
|
|
|
812
812
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
@@ -829,25 +829,25 @@ __exportStar(__webpack_require__(/*! ./isdk-info */ "./lib/models/isdk-info.ts")
|
|
|
829
829
|
__exportStar(__webpack_require__(/*! ./parameters */ "./lib/models/parameters.ts"), exports);
|
|
830
830
|
|
|
831
831
|
|
|
832
|
-
/***/ }
|
|
832
|
+
/***/ },
|
|
833
833
|
|
|
834
|
-
/***/ "./lib/models/isdk-info.ts"
|
|
834
|
+
/***/ "./lib/models/isdk-info.ts"
|
|
835
835
|
/*!*********************************!*\
|
|
836
836
|
!*** ./lib/models/isdk-info.ts ***!
|
|
837
837
|
\*********************************/
|
|
838
|
-
|
|
838
|
+
(__unused_webpack_module, exports) {
|
|
839
839
|
|
|
840
840
|
|
|
841
841
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
842
842
|
|
|
843
843
|
|
|
844
|
-
/***/ }
|
|
844
|
+
/***/ },
|
|
845
845
|
|
|
846
|
-
/***/ "./lib/models/parameters.ts"
|
|
846
|
+
/***/ "./lib/models/parameters.ts"
|
|
847
847
|
/*!**********************************!*\
|
|
848
848
|
!*** ./lib/models/parameters.ts ***!
|
|
849
849
|
\**********************************/
|
|
850
|
-
|
|
850
|
+
(__unused_webpack_module, exports) {
|
|
851
851
|
|
|
852
852
|
|
|
853
853
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
@@ -879,27 +879,27 @@ var Parameters;
|
|
|
879
879
|
})(Parameters || (exports.Parameters = Parameters = {}));
|
|
880
880
|
|
|
881
881
|
|
|
882
|
-
/***/ }
|
|
882
|
+
/***/ },
|
|
883
883
|
|
|
884
|
-
/***/ "./lib/models/url.models.ts"
|
|
884
|
+
/***/ "./lib/models/url.models.ts"
|
|
885
885
|
/*!**********************************!*\
|
|
886
886
|
!*** ./lib/models/url.models.ts ***!
|
|
887
887
|
\**********************************/
|
|
888
|
-
|
|
888
|
+
(__unused_webpack_module, exports) {
|
|
889
889
|
|
|
890
890
|
|
|
891
891
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
892
892
|
|
|
893
893
|
|
|
894
|
-
/***/ }
|
|
894
|
+
/***/ },
|
|
895
895
|
|
|
896
|
-
/***/ "./node_modules/axios/dist/browser/axios.cjs"
|
|
896
|
+
/***/ "./node_modules/axios/dist/browser/axios.cjs"
|
|
897
897
|
/*!***************************************************!*\
|
|
898
898
|
!*** ./node_modules/axios/dist/browser/axios.cjs ***!
|
|
899
899
|
\***************************************************/
|
|
900
|
-
|
|
900
|
+
(module, __unused_webpack_exports, __webpack_require__) {
|
|
901
901
|
|
|
902
|
-
/*! Axios v1.
|
|
902
|
+
/*! Axios v1.15.0 Copyright (c) 2026 Matt Zabriskie and contributors */
|
|
903
903
|
|
|
904
904
|
|
|
905
905
|
/**
|
|
@@ -949,7 +949,7 @@ const { isArray } = Array;
|
|
|
949
949
|
*
|
|
950
950
|
* @returns {boolean} True if the value is undefined, otherwise false
|
|
951
951
|
*/
|
|
952
|
-
const isUndefined = typeOfTest(
|
|
952
|
+
const isUndefined = typeOfTest('undefined');
|
|
953
953
|
|
|
954
954
|
/**
|
|
955
955
|
* Determine if a value is a Buffer
|
|
@@ -976,7 +976,7 @@ function isBuffer(val) {
|
|
|
976
976
|
*
|
|
977
977
|
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
|
978
978
|
*/
|
|
979
|
-
const isArrayBuffer = kindOfTest(
|
|
979
|
+
const isArrayBuffer = kindOfTest('ArrayBuffer');
|
|
980
980
|
|
|
981
981
|
/**
|
|
982
982
|
* Determine if a value is a view on an ArrayBuffer
|
|
@@ -987,7 +987,7 @@ const isArrayBuffer = kindOfTest("ArrayBuffer");
|
|
|
987
987
|
*/
|
|
988
988
|
function isArrayBufferView(val) {
|
|
989
989
|
let result;
|
|
990
|
-
if (typeof ArrayBuffer !==
|
|
990
|
+
if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
|
|
991
991
|
result = ArrayBuffer.isView(val);
|
|
992
992
|
} else {
|
|
993
993
|
result = val && val.buffer && isArrayBuffer(val.buffer);
|
|
@@ -1002,7 +1002,7 @@ function isArrayBufferView(val) {
|
|
|
1002
1002
|
*
|
|
1003
1003
|
* @returns {boolean} True if value is a String, otherwise false
|
|
1004
1004
|
*/
|
|
1005
|
-
const isString = typeOfTest(
|
|
1005
|
+
const isString = typeOfTest('string');
|
|
1006
1006
|
|
|
1007
1007
|
/**
|
|
1008
1008
|
* Determine if a value is a Function
|
|
@@ -1010,7 +1010,7 @@ const isString = typeOfTest("string");
|
|
|
1010
1010
|
* @param {*} val The value to test
|
|
1011
1011
|
* @returns {boolean} True if value is a Function, otherwise false
|
|
1012
1012
|
*/
|
|
1013
|
-
const isFunction$1 = typeOfTest(
|
|
1013
|
+
const isFunction$1 = typeOfTest('function');
|
|
1014
1014
|
|
|
1015
1015
|
/**
|
|
1016
1016
|
* Determine if a value is a Number
|
|
@@ -1019,7 +1019,7 @@ const isFunction$1 = typeOfTest("function");
|
|
|
1019
1019
|
*
|
|
1020
1020
|
* @returns {boolean} True if value is a Number, otherwise false
|
|
1021
1021
|
*/
|
|
1022
|
-
const isNumber = typeOfTest(
|
|
1022
|
+
const isNumber = typeOfTest('number');
|
|
1023
1023
|
|
|
1024
1024
|
/**
|
|
1025
1025
|
* Determine if a value is an Object
|
|
@@ -1028,7 +1028,7 @@ const isNumber = typeOfTest("number");
|
|
|
1028
1028
|
*
|
|
1029
1029
|
* @returns {boolean} True if value is an Object, otherwise false
|
|
1030
1030
|
*/
|
|
1031
|
-
const isObject = (thing) => thing !== null && typeof thing ===
|
|
1031
|
+
const isObject = (thing) => thing !== null && typeof thing === 'object';
|
|
1032
1032
|
|
|
1033
1033
|
/**
|
|
1034
1034
|
* Determine if a value is a Boolean
|
|
@@ -1046,7 +1046,7 @@ const isBoolean = (thing) => thing === true || thing === false;
|
|
|
1046
1046
|
* @returns {boolean} True if value is a plain Object, otherwise false
|
|
1047
1047
|
*/
|
|
1048
1048
|
const isPlainObject = (val) => {
|
|
1049
|
-
if (kindOf(val) !==
|
|
1049
|
+
if (kindOf(val) !== 'object') {
|
|
1050
1050
|
return false;
|
|
1051
1051
|
}
|
|
1052
1052
|
|
|
@@ -1074,10 +1074,7 @@ const isEmptyObject = (val) => {
|
|
|
1074
1074
|
}
|
|
1075
1075
|
|
|
1076
1076
|
try {
|
|
1077
|
-
return (
|
|
1078
|
-
Object.keys(val).length === 0 &&
|
|
1079
|
-
Object.getPrototypeOf(val) === Object.prototype
|
|
1080
|
-
);
|
|
1077
|
+
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
|
1081
1078
|
} catch (e) {
|
|
1082
1079
|
// Fallback for any other objects that might cause RangeError with Object.keys()
|
|
1083
1080
|
return false;
|
|
@@ -1091,7 +1088,7 @@ const isEmptyObject = (val) => {
|
|
|
1091
1088
|
*
|
|
1092
1089
|
* @returns {boolean} True if value is a Date, otherwise false
|
|
1093
1090
|
*/
|
|
1094
|
-
const isDate = kindOfTest(
|
|
1091
|
+
const isDate = kindOfTest('Date');
|
|
1095
1092
|
|
|
1096
1093
|
/**
|
|
1097
1094
|
* Determine if a value is a File
|
|
@@ -1100,7 +1097,32 @@ const isDate = kindOfTest("Date");
|
|
|
1100
1097
|
*
|
|
1101
1098
|
* @returns {boolean} True if value is a File, otherwise false
|
|
1102
1099
|
*/
|
|
1103
|
-
const isFile = kindOfTest(
|
|
1100
|
+
const isFile = kindOfTest('File');
|
|
1101
|
+
|
|
1102
|
+
/**
|
|
1103
|
+
* Determine if a value is a React Native Blob
|
|
1104
|
+
* React Native "blob": an object with a `uri` attribute. Optionally, it can
|
|
1105
|
+
* also have a `name` and `type` attribute to specify filename and content type
|
|
1106
|
+
*
|
|
1107
|
+
* @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71
|
|
1108
|
+
*
|
|
1109
|
+
* @param {*} value The value to test
|
|
1110
|
+
*
|
|
1111
|
+
* @returns {boolean} True if value is a React Native Blob, otherwise false
|
|
1112
|
+
*/
|
|
1113
|
+
const isReactNativeBlob = (value) => {
|
|
1114
|
+
return !!(value && typeof value.uri !== 'undefined');
|
|
1115
|
+
};
|
|
1116
|
+
|
|
1117
|
+
/**
|
|
1118
|
+
* Determine if environment is React Native
|
|
1119
|
+
* ReactNative `FormData` has a non-standard `getParts()` method
|
|
1120
|
+
*
|
|
1121
|
+
* @param {*} formData The formData to test
|
|
1122
|
+
*
|
|
1123
|
+
* @returns {boolean} True if environment is React Native, otherwise false
|
|
1124
|
+
*/
|
|
1125
|
+
const isReactNative = (formData) => formData && typeof formData.getParts !== 'undefined';
|
|
1104
1126
|
|
|
1105
1127
|
/**
|
|
1106
1128
|
* Determine if a value is a Blob
|
|
@@ -1109,7 +1131,7 @@ const isFile = kindOfTest("File");
|
|
|
1109
1131
|
*
|
|
1110
1132
|
* @returns {boolean} True if value is a Blob, otherwise false
|
|
1111
1133
|
*/
|
|
1112
|
-
const isBlob = kindOfTest(
|
|
1134
|
+
const isBlob = kindOfTest('Blob');
|
|
1113
1135
|
|
|
1114
1136
|
/**
|
|
1115
1137
|
* Determine if a value is a FileList
|
|
@@ -1118,7 +1140,7 @@ const isBlob = kindOfTest("Blob");
|
|
|
1118
1140
|
*
|
|
1119
1141
|
* @returns {boolean} True if value is a File, otherwise false
|
|
1120
1142
|
*/
|
|
1121
|
-
const isFileList = kindOfTest(
|
|
1143
|
+
const isFileList = kindOfTest('FileList');
|
|
1122
1144
|
|
|
1123
1145
|
/**
|
|
1124
1146
|
* Determine if a value is a Stream
|
|
@@ -1136,17 +1158,27 @@ const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
|
|
|
1136
1158
|
*
|
|
1137
1159
|
* @returns {boolean} True if value is an FormData, otherwise false
|
|
1138
1160
|
*/
|
|
1161
|
+
function getGlobal() {
|
|
1162
|
+
if (typeof globalThis !== 'undefined') return globalThis;
|
|
1163
|
+
if (typeof self !== 'undefined') return self;
|
|
1164
|
+
if (typeof window !== 'undefined') return window;
|
|
1165
|
+
if (typeof __webpack_require__.g !== 'undefined') return __webpack_require__.g;
|
|
1166
|
+
return {};
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
const G = getGlobal();
|
|
1170
|
+
const FormDataCtor = typeof G.FormData !== 'undefined' ? G.FormData : undefined;
|
|
1171
|
+
|
|
1139
1172
|
const isFormData = (thing) => {
|
|
1140
1173
|
let kind;
|
|
1141
|
-
return (
|
|
1142
|
-
thing
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
thing.toString() === "[object FormData]"))))
|
|
1174
|
+
return thing && (
|
|
1175
|
+
(FormDataCtor && thing instanceof FormDataCtor) || (
|
|
1176
|
+
isFunction$1(thing.append) && (
|
|
1177
|
+
(kind = kindOf(thing)) === 'formdata' ||
|
|
1178
|
+
// detect form-data instance
|
|
1179
|
+
(kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
|
|
1180
|
+
)
|
|
1181
|
+
)
|
|
1150
1182
|
);
|
|
1151
1183
|
};
|
|
1152
1184
|
|
|
@@ -1157,13 +1189,13 @@ const isFormData = (thing) => {
|
|
|
1157
1189
|
*
|
|
1158
1190
|
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
|
1159
1191
|
*/
|
|
1160
|
-
const isURLSearchParams = kindOfTest(
|
|
1192
|
+
const isURLSearchParams = kindOfTest('URLSearchParams');
|
|
1161
1193
|
|
|
1162
1194
|
const [isReadableStream, isRequest, isResponse, isHeaders] = [
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1195
|
+
'ReadableStream',
|
|
1196
|
+
'Request',
|
|
1197
|
+
'Response',
|
|
1198
|
+
'Headers',
|
|
1167
1199
|
].map(kindOfTest);
|
|
1168
1200
|
|
|
1169
1201
|
/**
|
|
@@ -1173,9 +1205,9 @@ const [isReadableStream, isRequest, isResponse, isHeaders] = [
|
|
|
1173
1205
|
*
|
|
1174
1206
|
* @returns {String} The String freed of excess whitespace
|
|
1175
1207
|
*/
|
|
1176
|
-
const trim = (str) =>
|
|
1177
|
-
str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
|
|
1178
|
-
|
|
1208
|
+
const trim = (str) => {
|
|
1209
|
+
return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
|
1210
|
+
};
|
|
1179
1211
|
/**
|
|
1180
1212
|
* Iterate over an Array or an Object invoking a function for each item.
|
|
1181
1213
|
*
|
|
@@ -1194,7 +1226,7 @@ const trim = (str) =>
|
|
|
1194
1226
|
*/
|
|
1195
1227
|
function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
1196
1228
|
// Don't bother if no value provided
|
|
1197
|
-
if (obj === null || typeof obj ===
|
|
1229
|
+
if (obj === null || typeof obj === 'undefined') {
|
|
1198
1230
|
return;
|
|
1199
1231
|
}
|
|
1200
1232
|
|
|
@@ -1202,7 +1234,7 @@ function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
|
1202
1234
|
let l;
|
|
1203
1235
|
|
|
1204
1236
|
// Force an array if not already something iterable
|
|
1205
|
-
if (typeof obj !==
|
|
1237
|
+
if (typeof obj !== 'object') {
|
|
1206
1238
|
/*eslint no-param-reassign:0*/
|
|
1207
1239
|
obj = [obj];
|
|
1208
1240
|
}
|
|
@@ -1219,9 +1251,7 @@ function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
|
1219
1251
|
}
|
|
1220
1252
|
|
|
1221
1253
|
// Iterate over object keys
|
|
1222
|
-
const keys = allOwnKeys
|
|
1223
|
-
? Object.getOwnPropertyNames(obj)
|
|
1224
|
-
: Object.keys(obj);
|
|
1254
|
+
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
1225
1255
|
const len = keys.length;
|
|
1226
1256
|
let key;
|
|
1227
1257
|
|
|
@@ -1232,6 +1262,14 @@ function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
|
1232
1262
|
}
|
|
1233
1263
|
}
|
|
1234
1264
|
|
|
1265
|
+
/**
|
|
1266
|
+
* Finds a key in an object, case-insensitive, returning the actual key name.
|
|
1267
|
+
* Returns null if the object is a Buffer or if no match is found.
|
|
1268
|
+
*
|
|
1269
|
+
* @param {Object} obj - The object to search.
|
|
1270
|
+
* @param {string} key - The key to find (case-insensitive).
|
|
1271
|
+
* @returns {?string} The actual key name if found, otherwise null.
|
|
1272
|
+
*/
|
|
1235
1273
|
function findKey(obj, key) {
|
|
1236
1274
|
if (isBuffer(obj)) {
|
|
1237
1275
|
return null;
|
|
@@ -1252,16 +1290,11 @@ function findKey(obj, key) {
|
|
|
1252
1290
|
|
|
1253
1291
|
const _global = (() => {
|
|
1254
1292
|
/*eslint no-undef:0*/
|
|
1255
|
-
if (typeof globalThis !==
|
|
1256
|
-
return typeof self !==
|
|
1257
|
-
? self
|
|
1258
|
-
: typeof window !== "undefined"
|
|
1259
|
-
? window
|
|
1260
|
-
: __webpack_require__.g;
|
|
1293
|
+
if (typeof globalThis !== 'undefined') return globalThis;
|
|
1294
|
+
return typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : __webpack_require__.g;
|
|
1261
1295
|
})();
|
|
1262
1296
|
|
|
1263
|
-
const isContextDefined = (context) =>
|
|
1264
|
-
!isUndefined(context) && context !== _global;
|
|
1297
|
+
const isContextDefined = (context) => !isUndefined(context) && context !== _global;
|
|
1265
1298
|
|
|
1266
1299
|
/**
|
|
1267
1300
|
* Accepts varargs expecting each argument to be an object, then
|
|
@@ -1286,7 +1319,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
1286
1319
|
const result = {};
|
|
1287
1320
|
const assignValue = (val, key) => {
|
|
1288
1321
|
// Skip dangerous property names to prevent prototype pollution
|
|
1289
|
-
if (key ===
|
|
1322
|
+
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
|
1290
1323
|
return;
|
|
1291
1324
|
}
|
|
1292
1325
|
|
|
@@ -1339,7 +1372,7 @@ const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
|
|
|
1339
1372
|
});
|
|
1340
1373
|
}
|
|
1341
1374
|
},
|
|
1342
|
-
{ allOwnKeys }
|
|
1375
|
+
{ allOwnKeys }
|
|
1343
1376
|
);
|
|
1344
1377
|
return a;
|
|
1345
1378
|
};
|
|
@@ -1368,17 +1401,14 @@ const stripBOM = (content) => {
|
|
|
1368
1401
|
* @returns {void}
|
|
1369
1402
|
*/
|
|
1370
1403
|
const inherits = (constructor, superConstructor, props, descriptors) => {
|
|
1371
|
-
constructor.prototype = Object.create(
|
|
1372
|
-
|
|
1373
|
-
descriptors,
|
|
1374
|
-
);
|
|
1375
|
-
Object.defineProperty(constructor.prototype, "constructor", {
|
|
1404
|
+
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
|
1405
|
+
Object.defineProperty(constructor.prototype, 'constructor', {
|
|
1376
1406
|
value: constructor,
|
|
1377
1407
|
writable: true,
|
|
1378
1408
|
enumerable: false,
|
|
1379
1409
|
configurable: true,
|
|
1380
1410
|
});
|
|
1381
|
-
Object.defineProperty(constructor,
|
|
1411
|
+
Object.defineProperty(constructor, 'super', {
|
|
1382
1412
|
value: superConstructor.prototype,
|
|
1383
1413
|
});
|
|
1384
1414
|
props && Object.assign(constructor.prototype, props);
|
|
@@ -1408,20 +1438,13 @@ const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
|
|
|
1408
1438
|
i = props.length;
|
|
1409
1439
|
while (i-- > 0) {
|
|
1410
1440
|
prop = props[i];
|
|
1411
|
-
if (
|
|
1412
|
-
(!propFilter || propFilter(prop, sourceObj, destObj)) &&
|
|
1413
|
-
!merged[prop]
|
|
1414
|
-
) {
|
|
1441
|
+
if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
|
|
1415
1442
|
destObj[prop] = sourceObj[prop];
|
|
1416
1443
|
merged[prop] = true;
|
|
1417
1444
|
}
|
|
1418
1445
|
}
|
|
1419
1446
|
sourceObj = filter !== false && getPrototypeOf(sourceObj);
|
|
1420
|
-
} while (
|
|
1421
|
-
sourceObj &&
|
|
1422
|
-
(!filter || filter(sourceObj, destObj)) &&
|
|
1423
|
-
sourceObj !== Object.prototype
|
|
1424
|
-
);
|
|
1447
|
+
} while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
|
1425
1448
|
|
|
1426
1449
|
return destObj;
|
|
1427
1450
|
};
|
|
@@ -1478,7 +1501,7 @@ const isTypedArray = ((TypedArray) => {
|
|
|
1478
1501
|
return (thing) => {
|
|
1479
1502
|
return TypedArray && thing instanceof TypedArray;
|
|
1480
1503
|
};
|
|
1481
|
-
})(typeof Uint8Array !==
|
|
1504
|
+
})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
|
|
1482
1505
|
|
|
1483
1506
|
/**
|
|
1484
1507
|
* For each entry in the object, call the function with the key and value.
|
|
@@ -1521,14 +1544,12 @@ const matchAll = (regExp, str) => {
|
|
|
1521
1544
|
};
|
|
1522
1545
|
|
|
1523
1546
|
/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
|
|
1524
|
-
const isHTMLForm = kindOfTest(
|
|
1547
|
+
const isHTMLForm = kindOfTest('HTMLFormElement');
|
|
1525
1548
|
|
|
1526
1549
|
const toCamelCase = (str) => {
|
|
1527
|
-
return str
|
|
1528
|
-
.
|
|
1529
|
-
|
|
1530
|
-
return p1.toUpperCase() + p2;
|
|
1531
|
-
});
|
|
1550
|
+
return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
|
|
1551
|
+
return p1.toUpperCase() + p2;
|
|
1552
|
+
});
|
|
1532
1553
|
};
|
|
1533
1554
|
|
|
1534
1555
|
/* Creating a function that will check if an object has a property. */
|
|
@@ -1545,7 +1566,7 @@ const hasOwnProperty = (
|
|
|
1545
1566
|
*
|
|
1546
1567
|
* @returns {boolean} True if value is a RegExp object, otherwise false
|
|
1547
1568
|
*/
|
|
1548
|
-
const isRegExp = kindOfTest(
|
|
1569
|
+
const isRegExp = kindOfTest('RegExp');
|
|
1549
1570
|
|
|
1550
1571
|
const reduceDescriptors = (obj, reducer) => {
|
|
1551
1572
|
const descriptors = Object.getOwnPropertyDescriptors(obj);
|
|
@@ -1569,10 +1590,7 @@ const reduceDescriptors = (obj, reducer) => {
|
|
|
1569
1590
|
const freezeMethods = (obj) => {
|
|
1570
1591
|
reduceDescriptors(obj, (descriptor, name) => {
|
|
1571
1592
|
// skip restricted props in strict mode
|
|
1572
|
-
if (
|
|
1573
|
-
isFunction$1(obj) &&
|
|
1574
|
-
["arguments", "caller", "callee"].indexOf(name) !== -1
|
|
1575
|
-
) {
|
|
1593
|
+
if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
|
1576
1594
|
return false;
|
|
1577
1595
|
}
|
|
1578
1596
|
|
|
@@ -1582,7 +1600,7 @@ const freezeMethods = (obj) => {
|
|
|
1582
1600
|
|
|
1583
1601
|
descriptor.enumerable = false;
|
|
1584
1602
|
|
|
1585
|
-
if (
|
|
1603
|
+
if ('writable' in descriptor) {
|
|
1586
1604
|
descriptor.writable = false;
|
|
1587
1605
|
return;
|
|
1588
1606
|
}
|
|
@@ -1595,6 +1613,14 @@ const freezeMethods = (obj) => {
|
|
|
1595
1613
|
});
|
|
1596
1614
|
};
|
|
1597
1615
|
|
|
1616
|
+
/**
|
|
1617
|
+
* Converts an array or a delimited string into an object set with values as keys and true as values.
|
|
1618
|
+
* Useful for fast membership checks.
|
|
1619
|
+
*
|
|
1620
|
+
* @param {Array|string} arrayOrString - The array or string to convert.
|
|
1621
|
+
* @param {string} delimiter - The delimiter to use if input is a string.
|
|
1622
|
+
* @returns {Object} An object with keys from the array or string, values set to true.
|
|
1623
|
+
*/
|
|
1598
1624
|
const toObjectSet = (arrayOrString, delimiter) => {
|
|
1599
1625
|
const obj = {};
|
|
1600
1626
|
|
|
@@ -1604,9 +1630,7 @@ const toObjectSet = (arrayOrString, delimiter) => {
|
|
|
1604
1630
|
});
|
|
1605
1631
|
};
|
|
1606
1632
|
|
|
1607
|
-
isArray(arrayOrString)
|
|
1608
|
-
? define(arrayOrString)
|
|
1609
|
-
: define(String(arrayOrString).split(delimiter));
|
|
1633
|
+
isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
|
|
1610
1634
|
|
|
1611
1635
|
return obj;
|
|
1612
1636
|
};
|
|
@@ -1614,9 +1638,7 @@ const toObjectSet = (arrayOrString, delimiter) => {
|
|
|
1614
1638
|
const noop = () => {};
|
|
1615
1639
|
|
|
1616
1640
|
const toFiniteNumber = (value, defaultValue) => {
|
|
1617
|
-
return value != null && Number.isFinite((value = +value))
|
|
1618
|
-
? value
|
|
1619
|
-
: defaultValue;
|
|
1641
|
+
return value != null && Number.isFinite((value = +value)) ? value : defaultValue;
|
|
1620
1642
|
};
|
|
1621
1643
|
|
|
1622
1644
|
/**
|
|
@@ -1630,11 +1652,17 @@ function isSpecCompliantForm(thing) {
|
|
|
1630
1652
|
return !!(
|
|
1631
1653
|
thing &&
|
|
1632
1654
|
isFunction$1(thing.append) &&
|
|
1633
|
-
thing[toStringTag] ===
|
|
1655
|
+
thing[toStringTag] === 'FormData' &&
|
|
1634
1656
|
thing[iterator]
|
|
1635
1657
|
);
|
|
1636
1658
|
}
|
|
1637
1659
|
|
|
1660
|
+
/**
|
|
1661
|
+
* Recursively converts an object to a JSON-compatible object, handling circular references and Buffers.
|
|
1662
|
+
*
|
|
1663
|
+
* @param {Object} obj - The object to convert.
|
|
1664
|
+
* @returns {Object} The JSON-compatible object.
|
|
1665
|
+
*/
|
|
1638
1666
|
const toJSONObject = (obj) => {
|
|
1639
1667
|
const stack = new Array(10);
|
|
1640
1668
|
|
|
@@ -1649,7 +1677,7 @@ const toJSONObject = (obj) => {
|
|
|
1649
1677
|
return source;
|
|
1650
1678
|
}
|
|
1651
1679
|
|
|
1652
|
-
if (!(
|
|
1680
|
+
if (!('toJSON' in source)) {
|
|
1653
1681
|
stack[i] = source;
|
|
1654
1682
|
const target = isArray(source) ? [] : {};
|
|
1655
1683
|
|
|
@@ -1670,8 +1698,20 @@ const toJSONObject = (obj) => {
|
|
|
1670
1698
|
return visit(obj, 0);
|
|
1671
1699
|
};
|
|
1672
1700
|
|
|
1673
|
-
|
|
1701
|
+
/**
|
|
1702
|
+
* Determines if a value is an async function.
|
|
1703
|
+
*
|
|
1704
|
+
* @param {*} thing - The value to test.
|
|
1705
|
+
* @returns {boolean} True if value is an async function, otherwise false.
|
|
1706
|
+
*/
|
|
1707
|
+
const isAsyncFn = kindOfTest('AsyncFunction');
|
|
1674
1708
|
|
|
1709
|
+
/**
|
|
1710
|
+
* Determines if a value is thenable (has then and catch methods).
|
|
1711
|
+
*
|
|
1712
|
+
* @param {*} thing - The value to test.
|
|
1713
|
+
* @returns {boolean} True if value is thenable, otherwise false.
|
|
1714
|
+
*/
|
|
1675
1715
|
const isThenable = (thing) =>
|
|
1676
1716
|
thing &&
|
|
1677
1717
|
(isObject(thing) || isFunction$1(thing)) &&
|
|
@@ -1681,6 +1721,14 @@ const isThenable = (thing) =>
|
|
|
1681
1721
|
// original code
|
|
1682
1722
|
// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
|
|
1683
1723
|
|
|
1724
|
+
/**
|
|
1725
|
+
* Provides a cross-platform setImmediate implementation.
|
|
1726
|
+
* Uses native setImmediate if available, otherwise falls back to postMessage or setTimeout.
|
|
1727
|
+
*
|
|
1728
|
+
* @param {boolean} setImmediateSupported - Whether setImmediate is supported.
|
|
1729
|
+
* @param {boolean} postMessageSupported - Whether postMessage is supported.
|
|
1730
|
+
* @returns {Function} A function to schedule a callback asynchronously.
|
|
1731
|
+
*/
|
|
1684
1732
|
const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
1685
1733
|
if (setImmediateSupported) {
|
|
1686
1734
|
return setImmediate;
|
|
@@ -1689,27 +1737,33 @@ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
|
1689
1737
|
return postMessageSupported
|
|
1690
1738
|
? ((token, callbacks) => {
|
|
1691
1739
|
_global.addEventListener(
|
|
1692
|
-
|
|
1740
|
+
'message',
|
|
1693
1741
|
({ source, data }) => {
|
|
1694
1742
|
if (source === _global && data === token) {
|
|
1695
1743
|
callbacks.length && callbacks.shift()();
|
|
1696
1744
|
}
|
|
1697
1745
|
},
|
|
1698
|
-
false
|
|
1746
|
+
false
|
|
1699
1747
|
);
|
|
1700
1748
|
|
|
1701
1749
|
return (cb) => {
|
|
1702
1750
|
callbacks.push(cb);
|
|
1703
|
-
_global.postMessage(token,
|
|
1751
|
+
_global.postMessage(token, '*');
|
|
1704
1752
|
};
|
|
1705
1753
|
})(`axios@${Math.random()}`, [])
|
|
1706
1754
|
: (cb) => setTimeout(cb);
|
|
1707
|
-
})(typeof setImmediate ===
|
|
1755
|
+
})(typeof setImmediate === 'function', isFunction$1(_global.postMessage));
|
|
1708
1756
|
|
|
1757
|
+
/**
|
|
1758
|
+
* Schedules a microtask or asynchronous callback as soon as possible.
|
|
1759
|
+
* Uses queueMicrotask if available, otherwise falls back to process.nextTick or _setImmediate.
|
|
1760
|
+
*
|
|
1761
|
+
* @type {Function}
|
|
1762
|
+
*/
|
|
1709
1763
|
const asap =
|
|
1710
|
-
typeof queueMicrotask !==
|
|
1764
|
+
typeof queueMicrotask !== 'undefined'
|
|
1711
1765
|
? queueMicrotask.bind(_global)
|
|
1712
|
-
: (typeof process !==
|
|
1766
|
+
: (typeof process !== 'undefined' && process.nextTick) || _setImmediate;
|
|
1713
1767
|
|
|
1714
1768
|
// *********************
|
|
1715
1769
|
|
|
@@ -1734,6 +1788,8 @@ var utils$1 = {
|
|
|
1734
1788
|
isUndefined,
|
|
1735
1789
|
isDate,
|
|
1736
1790
|
isFile,
|
|
1791
|
+
isReactNativeBlob,
|
|
1792
|
+
isReactNative,
|
|
1737
1793
|
isBlob,
|
|
1738
1794
|
isRegExp,
|
|
1739
1795
|
isFunction: isFunction$1,
|
|
@@ -1776,14 +1832,20 @@ var utils$1 = {
|
|
|
1776
1832
|
};
|
|
1777
1833
|
|
|
1778
1834
|
class AxiosError extends Error {
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1835
|
+
static from(error, code, config, request, response, customProps) {
|
|
1836
|
+
const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
|
|
1837
|
+
axiosError.cause = error;
|
|
1838
|
+
axiosError.name = error.name;
|
|
1839
|
+
|
|
1840
|
+
// Preserve status from the original error if not already set from response
|
|
1841
|
+
if (error.status != null && axiosError.status == null) {
|
|
1842
|
+
axiosError.status = error.status;
|
|
1785
1843
|
}
|
|
1786
1844
|
|
|
1845
|
+
customProps && Object.assign(axiosError, customProps);
|
|
1846
|
+
return axiosError;
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1787
1849
|
/**
|
|
1788
1850
|
* Create an Error with the specified message, config, error code, request and response.
|
|
1789
1851
|
*
|
|
@@ -1796,37 +1858,48 @@ class AxiosError extends Error {
|
|
|
1796
1858
|
* @returns {Error} The created error.
|
|
1797
1859
|
*/
|
|
1798
1860
|
constructor(message, code, config, request, response) {
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1861
|
+
super(message);
|
|
1862
|
+
|
|
1863
|
+
// Make message enumerable to maintain backward compatibility
|
|
1864
|
+
// The native Error constructor sets message as non-enumerable,
|
|
1865
|
+
// but axios < v1.13.3 had it as enumerable
|
|
1866
|
+
Object.defineProperty(this, 'message', {
|
|
1867
|
+
value: message,
|
|
1868
|
+
enumerable: true,
|
|
1869
|
+
writable: true,
|
|
1870
|
+
configurable: true
|
|
1871
|
+
});
|
|
1872
|
+
|
|
1873
|
+
this.name = 'AxiosError';
|
|
1874
|
+
this.isAxiosError = true;
|
|
1875
|
+
code && (this.code = code);
|
|
1876
|
+
config && (this.config = config);
|
|
1877
|
+
request && (this.request = request);
|
|
1878
|
+
if (response) {
|
|
1879
|
+
this.response = response;
|
|
1880
|
+
this.status = response.status;
|
|
1881
|
+
}
|
|
1809
1882
|
}
|
|
1810
1883
|
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1884
|
+
toJSON() {
|
|
1885
|
+
return {
|
|
1886
|
+
// Standard
|
|
1887
|
+
message: this.message,
|
|
1888
|
+
name: this.name,
|
|
1889
|
+
// Microsoft
|
|
1890
|
+
description: this.description,
|
|
1891
|
+
number: this.number,
|
|
1892
|
+
// Mozilla
|
|
1893
|
+
fileName: this.fileName,
|
|
1894
|
+
lineNumber: this.lineNumber,
|
|
1895
|
+
columnNumber: this.columnNumber,
|
|
1896
|
+
stack: this.stack,
|
|
1897
|
+
// Axios
|
|
1898
|
+
config: utils$1.toJSONObject(this.config),
|
|
1899
|
+
code: this.code,
|
|
1900
|
+
status: this.status,
|
|
1901
|
+
};
|
|
1902
|
+
}
|
|
1830
1903
|
}
|
|
1831
1904
|
|
|
1832
1905
|
// This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
|
|
@@ -1843,8 +1916,6 @@ AxiosError.ERR_CANCELED = 'ERR_CANCELED';
|
|
|
1843
1916
|
AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
|
|
1844
1917
|
AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
|
|
1845
1918
|
|
|
1846
|
-
var AxiosError$1 = AxiosError;
|
|
1847
|
-
|
|
1848
1919
|
// eslint-disable-next-line strict
|
|
1849
1920
|
var httpAdapter = null;
|
|
1850
1921
|
|
|
@@ -1881,11 +1952,14 @@ function removeBrackets(key) {
|
|
|
1881
1952
|
*/
|
|
1882
1953
|
function renderKey(path, key, dots) {
|
|
1883
1954
|
if (!path) return key;
|
|
1884
|
-
return path
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1955
|
+
return path
|
|
1956
|
+
.concat(key)
|
|
1957
|
+
.map(function each(token, i) {
|
|
1958
|
+
// eslint-disable-next-line no-param-reassign
|
|
1959
|
+
token = removeBrackets(token);
|
|
1960
|
+
return !dots && i ? '[' + token + ']' : token;
|
|
1961
|
+
})
|
|
1962
|
+
.join(dots ? '.' : '');
|
|
1889
1963
|
}
|
|
1890
1964
|
|
|
1891
1965
|
/**
|
|
@@ -1935,21 +2009,26 @@ function toFormData(obj, formData, options) {
|
|
|
1935
2009
|
formData = formData || new (FormData)();
|
|
1936
2010
|
|
|
1937
2011
|
// eslint-disable-next-line no-param-reassign
|
|
1938
|
-
options = utils$1.toFlatObject(
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
2012
|
+
options = utils$1.toFlatObject(
|
|
2013
|
+
options,
|
|
2014
|
+
{
|
|
2015
|
+
metaTokens: true,
|
|
2016
|
+
dots: false,
|
|
2017
|
+
indexes: false,
|
|
2018
|
+
},
|
|
2019
|
+
false,
|
|
2020
|
+
function defined(option, source) {
|
|
2021
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
2022
|
+
return !utils$1.isUndefined(source[option]);
|
|
2023
|
+
}
|
|
2024
|
+
);
|
|
1946
2025
|
|
|
1947
2026
|
const metaTokens = options.metaTokens;
|
|
1948
2027
|
// eslint-disable-next-line no-use-before-define
|
|
1949
2028
|
const visitor = options.visitor || defaultVisitor;
|
|
1950
2029
|
const dots = options.dots;
|
|
1951
2030
|
const indexes = options.indexes;
|
|
1952
|
-
const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
|
|
2031
|
+
const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
|
|
1953
2032
|
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
|
|
1954
2033
|
|
|
1955
2034
|
if (!utils$1.isFunction(visitor)) {
|
|
@@ -1968,7 +2047,7 @@ function toFormData(obj, formData, options) {
|
|
|
1968
2047
|
}
|
|
1969
2048
|
|
|
1970
2049
|
if (!useBlob && utils$1.isBlob(value)) {
|
|
1971
|
-
throw new AxiosError
|
|
2050
|
+
throw new AxiosError('Blob is not supported. Use a Buffer instead.');
|
|
1972
2051
|
}
|
|
1973
2052
|
|
|
1974
2053
|
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
|
|
@@ -1991,6 +2070,11 @@ function toFormData(obj, formData, options) {
|
|
|
1991
2070
|
function defaultVisitor(value, key, path) {
|
|
1992
2071
|
let arr = value;
|
|
1993
2072
|
|
|
2073
|
+
if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
|
|
2074
|
+
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
2075
|
+
return false;
|
|
2076
|
+
}
|
|
2077
|
+
|
|
1994
2078
|
if (value && !path && typeof value === 'object') {
|
|
1995
2079
|
if (utils$1.endsWith(key, '{}')) {
|
|
1996
2080
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -1999,17 +2083,22 @@ function toFormData(obj, formData, options) {
|
|
|
1999
2083
|
value = JSON.stringify(value);
|
|
2000
2084
|
} else if (
|
|
2001
2085
|
(utils$1.isArray(value) && isFlatArray(value)) ||
|
|
2002
|
-
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
|
|
2003
|
-
|
|
2086
|
+
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
|
|
2087
|
+
) {
|
|
2004
2088
|
// eslint-disable-next-line no-param-reassign
|
|
2005
2089
|
key = removeBrackets(key);
|
|
2006
2090
|
|
|
2007
2091
|
arr.forEach(function each(el, index) {
|
|
2008
|
-
!(utils$1.isUndefined(el) || el === null) &&
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2092
|
+
!(utils$1.isUndefined(el) || el === null) &&
|
|
2093
|
+
formData.append(
|
|
2094
|
+
// eslint-disable-next-line no-nested-ternary
|
|
2095
|
+
indexes === true
|
|
2096
|
+
? renderKey([key], index, dots)
|
|
2097
|
+
: indexes === null
|
|
2098
|
+
? key
|
|
2099
|
+
: key + '[]',
|
|
2100
|
+
convertValue(el)
|
|
2101
|
+
);
|
|
2013
2102
|
});
|
|
2014
2103
|
return false;
|
|
2015
2104
|
}
|
|
@@ -2029,7 +2118,7 @@ function toFormData(obj, formData, options) {
|
|
|
2029
2118
|
const exposedHelpers = Object.assign(predicates, {
|
|
2030
2119
|
defaultVisitor,
|
|
2031
2120
|
convertValue,
|
|
2032
|
-
isVisitable
|
|
2121
|
+
isVisitable,
|
|
2033
2122
|
});
|
|
2034
2123
|
|
|
2035
2124
|
function build(value, path) {
|
|
@@ -2042,9 +2131,9 @@ function toFormData(obj, formData, options) {
|
|
|
2042
2131
|
stack.push(value);
|
|
2043
2132
|
|
|
2044
2133
|
utils$1.forEach(value, function each(el, key) {
|
|
2045
|
-
const result =
|
|
2046
|
-
|
|
2047
|
-
|
|
2134
|
+
const result =
|
|
2135
|
+
!(utils$1.isUndefined(el) || el === null) &&
|
|
2136
|
+
visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
|
|
2048
2137
|
|
|
2049
2138
|
if (result === true) {
|
|
2050
2139
|
build(el, path ? path.concat(key) : [key]);
|
|
@@ -2079,7 +2168,7 @@ function encode$1(str) {
|
|
|
2079
2168
|
')': '%29',
|
|
2080
2169
|
'~': '%7E',
|
|
2081
2170
|
'%20': '+',
|
|
2082
|
-
'%00': '\x00'
|
|
2171
|
+
'%00': '\x00',
|
|
2083
2172
|
};
|
|
2084
2173
|
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
|
2085
2174
|
return charMap[match];
|
|
@@ -2107,29 +2196,33 @@ prototype.append = function append(name, value) {
|
|
|
2107
2196
|
};
|
|
2108
2197
|
|
|
2109
2198
|
prototype.toString = function toString(encoder) {
|
|
2110
|
-
const _encode = encoder
|
|
2111
|
-
|
|
2112
|
-
|
|
2199
|
+
const _encode = encoder
|
|
2200
|
+
? function (value) {
|
|
2201
|
+
return encoder.call(this, value, encode$1);
|
|
2202
|
+
}
|
|
2203
|
+
: encode$1;
|
|
2113
2204
|
|
|
2114
|
-
return this._pairs
|
|
2115
|
-
|
|
2116
|
-
|
|
2205
|
+
return this._pairs
|
|
2206
|
+
.map(function each(pair) {
|
|
2207
|
+
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
|
2208
|
+
}, '')
|
|
2209
|
+
.join('&');
|
|
2117
2210
|
};
|
|
2118
2211
|
|
|
2119
2212
|
/**
|
|
2120
|
-
* It replaces
|
|
2121
|
-
*
|
|
2213
|
+
* It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
|
|
2214
|
+
* their plain counterparts (`:`, `$`, `,`, `+`).
|
|
2122
2215
|
*
|
|
2123
2216
|
* @param {string} val The value to be encoded.
|
|
2124
2217
|
*
|
|
2125
2218
|
* @returns {string} The encoded value.
|
|
2126
2219
|
*/
|
|
2127
2220
|
function encode(val) {
|
|
2128
|
-
return encodeURIComponent(val)
|
|
2129
|
-
replace(/%3A/gi, ':')
|
|
2130
|
-
replace(/%24/g, '$')
|
|
2131
|
-
replace(/%2C/gi, ',')
|
|
2132
|
-
replace(/%20/g, '+');
|
|
2221
|
+
return encodeURIComponent(val)
|
|
2222
|
+
.replace(/%3A/gi, ':')
|
|
2223
|
+
.replace(/%24/g, '$')
|
|
2224
|
+
.replace(/%2C/gi, ',')
|
|
2225
|
+
.replace(/%20/g, '+');
|
|
2133
2226
|
}
|
|
2134
2227
|
|
|
2135
2228
|
/**
|
|
@@ -2146,11 +2239,13 @@ function buildURL(url, params, options) {
|
|
|
2146
2239
|
return url;
|
|
2147
2240
|
}
|
|
2148
2241
|
|
|
2149
|
-
const _encode = options && options.encode || encode;
|
|
2242
|
+
const _encode = (options && options.encode) || encode;
|
|
2150
2243
|
|
|
2151
|
-
const _options = utils$1.isFunction(options)
|
|
2152
|
-
|
|
2153
|
-
|
|
2244
|
+
const _options = utils$1.isFunction(options)
|
|
2245
|
+
? {
|
|
2246
|
+
serialize: options,
|
|
2247
|
+
}
|
|
2248
|
+
: options;
|
|
2154
2249
|
|
|
2155
2250
|
const serializeFn = _options && _options.serialize;
|
|
2156
2251
|
|
|
@@ -2159,13 +2254,13 @@ function buildURL(url, params, options) {
|
|
|
2159
2254
|
if (serializeFn) {
|
|
2160
2255
|
serializedParams = serializeFn(params, _options);
|
|
2161
2256
|
} else {
|
|
2162
|
-
serializedParams = utils$1.isURLSearchParams(params)
|
|
2163
|
-
params.toString()
|
|
2164
|
-
new AxiosURLSearchParams(params, _options).toString(_encode);
|
|
2257
|
+
serializedParams = utils$1.isURLSearchParams(params)
|
|
2258
|
+
? params.toString()
|
|
2259
|
+
: new AxiosURLSearchParams(params, _options).toString(_encode);
|
|
2165
2260
|
}
|
|
2166
2261
|
|
|
2167
2262
|
if (serializedParams) {
|
|
2168
|
-
const hashmarkIndex = url.indexOf(
|
|
2263
|
+
const hashmarkIndex = url.indexOf('#');
|
|
2169
2264
|
|
|
2170
2265
|
if (hashmarkIndex !== -1) {
|
|
2171
2266
|
url = url.slice(0, hashmarkIndex);
|
|
@@ -2195,7 +2290,7 @@ class InterceptorManager {
|
|
|
2195
2290
|
fulfilled,
|
|
2196
2291
|
rejected,
|
|
2197
2292
|
synchronous: options ? options.synchronous : false,
|
|
2198
|
-
runWhen: options ? options.runWhen : null
|
|
2293
|
+
runWhen: options ? options.runWhen : null,
|
|
2199
2294
|
});
|
|
2200
2295
|
return this.handlers.length - 1;
|
|
2201
2296
|
}
|
|
@@ -2243,13 +2338,11 @@ class InterceptorManager {
|
|
|
2243
2338
|
}
|
|
2244
2339
|
}
|
|
2245
2340
|
|
|
2246
|
-
var InterceptorManager$1 = InterceptorManager;
|
|
2247
|
-
|
|
2248
2341
|
var transitionalDefaults = {
|
|
2249
2342
|
silentJSONParsing: true,
|
|
2250
2343
|
forcedJSONParsing: true,
|
|
2251
2344
|
clarifyTimeoutError: false,
|
|
2252
|
-
legacyInterceptorReqResOrdering: true
|
|
2345
|
+
legacyInterceptorReqResOrdering: true,
|
|
2253
2346
|
};
|
|
2254
2347
|
|
|
2255
2348
|
var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
|
|
@@ -2263,14 +2356,14 @@ var platform$1 = {
|
|
|
2263
2356
|
classes: {
|
|
2264
2357
|
URLSearchParams: URLSearchParams$1,
|
|
2265
2358
|
FormData: FormData$1,
|
|
2266
|
-
Blob: Blob$1
|
|
2359
|
+
Blob: Blob$1,
|
|
2267
2360
|
},
|
|
2268
|
-
protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
|
|
2361
|
+
protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],
|
|
2269
2362
|
};
|
|
2270
2363
|
|
|
2271
2364
|
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
2272
2365
|
|
|
2273
|
-
const _navigator = typeof navigator === 'object' && navigator || undefined;
|
|
2366
|
+
const _navigator = (typeof navigator === 'object' && navigator) || undefined;
|
|
2274
2367
|
|
|
2275
2368
|
/**
|
|
2276
2369
|
* Determine if we're running in a standard browser environment
|
|
@@ -2289,7 +2382,8 @@ const _navigator = typeof navigator === 'object' && navigator || undefined;
|
|
|
2289
2382
|
*
|
|
2290
2383
|
* @returns {boolean}
|
|
2291
2384
|
*/
|
|
2292
|
-
const hasStandardBrowserEnv =
|
|
2385
|
+
const hasStandardBrowserEnv =
|
|
2386
|
+
hasBrowserEnv &&
|
|
2293
2387
|
(!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
|
|
2294
2388
|
|
|
2295
2389
|
/**
|
|
@@ -2310,25 +2404,25 @@ const hasStandardBrowserWebWorkerEnv = (() => {
|
|
|
2310
2404
|
);
|
|
2311
2405
|
})();
|
|
2312
2406
|
|
|
2313
|
-
const origin = hasBrowserEnv && window.location.href || 'http://localhost';
|
|
2407
|
+
const origin = (hasBrowserEnv && window.location.href) || 'http://localhost';
|
|
2314
2408
|
|
|
2315
2409
|
var utils = /*#__PURE__*/Object.freeze({
|
|
2316
2410
|
__proto__: null,
|
|
2317
2411
|
hasBrowserEnv: hasBrowserEnv,
|
|
2318
|
-
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
|
|
2319
2412
|
hasStandardBrowserEnv: hasStandardBrowserEnv,
|
|
2413
|
+
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
|
|
2320
2414
|
navigator: _navigator,
|
|
2321
2415
|
origin: origin
|
|
2322
2416
|
});
|
|
2323
2417
|
|
|
2324
2418
|
var platform = {
|
|
2325
2419
|
...utils,
|
|
2326
|
-
...platform$1
|
|
2420
|
+
...platform$1,
|
|
2327
2421
|
};
|
|
2328
2422
|
|
|
2329
2423
|
function toURLEncodedForm(data, options) {
|
|
2330
2424
|
return toFormData(data, new platform.classes.URLSearchParams(), {
|
|
2331
|
-
visitor: function(value, key, path, helpers) {
|
|
2425
|
+
visitor: function (value, key, path, helpers) {
|
|
2332
2426
|
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
2333
2427
|
this.append(key, value.toString('base64'));
|
|
2334
2428
|
return false;
|
|
@@ -2336,7 +2430,7 @@ function toURLEncodedForm(data, options) {
|
|
|
2336
2430
|
|
|
2337
2431
|
return helpers.defaultVisitor.apply(this, arguments);
|
|
2338
2432
|
},
|
|
2339
|
-
...options
|
|
2433
|
+
...options,
|
|
2340
2434
|
});
|
|
2341
2435
|
}
|
|
2342
2436
|
|
|
@@ -2352,7 +2446,7 @@ function parsePropPath(name) {
|
|
|
2352
2446
|
// foo.x.y.z
|
|
2353
2447
|
// foo-x-y-z
|
|
2354
2448
|
// foo x y z
|
|
2355
|
-
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
|
|
2449
|
+
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
|
|
2356
2450
|
return match[0] === '[]' ? '' : match[1] || match[0];
|
|
2357
2451
|
});
|
|
2358
2452
|
}
|
|
@@ -2456,96 +2550,107 @@ function stringifySafely(rawValue, parser, encoder) {
|
|
|
2456
2550
|
}
|
|
2457
2551
|
|
|
2458
2552
|
const defaults = {
|
|
2459
|
-
|
|
2460
2553
|
transitional: transitionalDefaults,
|
|
2461
2554
|
|
|
2462
2555
|
adapter: ['xhr', 'http', 'fetch'],
|
|
2463
2556
|
|
|
2464
|
-
transformRequest: [
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2557
|
+
transformRequest: [
|
|
2558
|
+
function transformRequest(data, headers) {
|
|
2559
|
+
const contentType = headers.getContentType() || '';
|
|
2560
|
+
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
|
2561
|
+
const isObjectPayload = utils$1.isObject(data);
|
|
2468
2562
|
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2563
|
+
if (isObjectPayload && utils$1.isHTMLForm(data)) {
|
|
2564
|
+
data = new FormData(data);
|
|
2565
|
+
}
|
|
2472
2566
|
|
|
2473
|
-
|
|
2567
|
+
const isFormData = utils$1.isFormData(data);
|
|
2474
2568
|
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2569
|
+
if (isFormData) {
|
|
2570
|
+
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
2571
|
+
}
|
|
2478
2572
|
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2573
|
+
if (
|
|
2574
|
+
utils$1.isArrayBuffer(data) ||
|
|
2575
|
+
utils$1.isBuffer(data) ||
|
|
2576
|
+
utils$1.isStream(data) ||
|
|
2577
|
+
utils$1.isFile(data) ||
|
|
2578
|
+
utils$1.isBlob(data) ||
|
|
2579
|
+
utils$1.isReadableStream(data)
|
|
2580
|
+
) {
|
|
2581
|
+
return data;
|
|
2582
|
+
}
|
|
2583
|
+
if (utils$1.isArrayBufferView(data)) {
|
|
2584
|
+
return data.buffer;
|
|
2585
|
+
}
|
|
2586
|
+
if (utils$1.isURLSearchParams(data)) {
|
|
2587
|
+
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
|
2588
|
+
return data.toString();
|
|
2589
|
+
}
|
|
2495
2590
|
|
|
2496
|
-
|
|
2591
|
+
let isFileList;
|
|
2497
2592
|
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2593
|
+
if (isObjectPayload) {
|
|
2594
|
+
if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
|
|
2595
|
+
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
2596
|
+
}
|
|
2502
2597
|
|
|
2503
|
-
|
|
2504
|
-
|
|
2598
|
+
if (
|
|
2599
|
+
(isFileList = utils$1.isFileList(data)) ||
|
|
2600
|
+
contentType.indexOf('multipart/form-data') > -1
|
|
2601
|
+
) {
|
|
2602
|
+
const _FormData = this.env && this.env.FormData;
|
|
2505
2603
|
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2604
|
+
return toFormData(
|
|
2605
|
+
isFileList ? { 'files[]': data } : data,
|
|
2606
|
+
_FormData && new _FormData(),
|
|
2607
|
+
this.formSerializer
|
|
2608
|
+
);
|
|
2609
|
+
}
|
|
2511
2610
|
}
|
|
2512
|
-
}
|
|
2513
2611
|
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2612
|
+
if (isObjectPayload || hasJSONContentType) {
|
|
2613
|
+
headers.setContentType('application/json', false);
|
|
2614
|
+
return stringifySafely(data);
|
|
2615
|
+
}
|
|
2518
2616
|
|
|
2519
|
-
|
|
2520
|
-
|
|
2617
|
+
return data;
|
|
2618
|
+
},
|
|
2619
|
+
],
|
|
2521
2620
|
|
|
2522
|
-
transformResponse: [
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2621
|
+
transformResponse: [
|
|
2622
|
+
function transformResponse(data) {
|
|
2623
|
+
const transitional = this.transitional || defaults.transitional;
|
|
2624
|
+
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
2625
|
+
const JSONRequested = this.responseType === 'json';
|
|
2526
2626
|
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2627
|
+
if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
|
|
2628
|
+
return data;
|
|
2629
|
+
}
|
|
2530
2630
|
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2631
|
+
if (
|
|
2632
|
+
data &&
|
|
2633
|
+
utils$1.isString(data) &&
|
|
2634
|
+
((forcedJSONParsing && !this.responseType) || JSONRequested)
|
|
2635
|
+
) {
|
|
2636
|
+
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
2637
|
+
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
2534
2638
|
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2639
|
+
try {
|
|
2640
|
+
return JSON.parse(data, this.parseReviver);
|
|
2641
|
+
} catch (e) {
|
|
2642
|
+
if (strictJSONParsing) {
|
|
2643
|
+
if (e.name === 'SyntaxError') {
|
|
2644
|
+
throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
|
|
2645
|
+
}
|
|
2646
|
+
throw e;
|
|
2541
2647
|
}
|
|
2542
|
-
throw e;
|
|
2543
2648
|
}
|
|
2544
2649
|
}
|
|
2545
|
-
}
|
|
2546
2650
|
|
|
2547
|
-
|
|
2548
|
-
|
|
2651
|
+
return data;
|
|
2652
|
+
},
|
|
2653
|
+
],
|
|
2549
2654
|
|
|
2550
2655
|
/**
|
|
2551
2656
|
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
@@ -2561,7 +2666,7 @@ const defaults = {
|
|
|
2561
2666
|
|
|
2562
2667
|
env: {
|
|
2563
2668
|
FormData: platform.classes.FormData,
|
|
2564
|
-
Blob: platform.classes.Blob
|
|
2669
|
+
Blob: platform.classes.Blob,
|
|
2565
2670
|
},
|
|
2566
2671
|
|
|
2567
2672
|
validateStatus: function validateStatus(status) {
|
|
@@ -2570,25 +2675,36 @@ const defaults = {
|
|
|
2570
2675
|
|
|
2571
2676
|
headers: {
|
|
2572
2677
|
common: {
|
|
2573
|
-
|
|
2574
|
-
'Content-Type': undefined
|
|
2575
|
-
}
|
|
2576
|
-
}
|
|
2678
|
+
Accept: 'application/json, text/plain, */*',
|
|
2679
|
+
'Content-Type': undefined,
|
|
2680
|
+
},
|
|
2681
|
+
},
|
|
2577
2682
|
};
|
|
2578
2683
|
|
|
2579
2684
|
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
|
|
2580
2685
|
defaults.headers[method] = {};
|
|
2581
2686
|
});
|
|
2582
2687
|
|
|
2583
|
-
var defaults$1 = defaults;
|
|
2584
|
-
|
|
2585
2688
|
// RawAxiosHeaders whose duplicates are ignored by node
|
|
2586
2689
|
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
2587
2690
|
const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
2588
|
-
'age',
|
|
2589
|
-
'
|
|
2590
|
-
'
|
|
2591
|
-
'
|
|
2691
|
+
'age',
|
|
2692
|
+
'authorization',
|
|
2693
|
+
'content-length',
|
|
2694
|
+
'content-type',
|
|
2695
|
+
'etag',
|
|
2696
|
+
'expires',
|
|
2697
|
+
'from',
|
|
2698
|
+
'host',
|
|
2699
|
+
'if-modified-since',
|
|
2700
|
+
'if-unmodified-since',
|
|
2701
|
+
'last-modified',
|
|
2702
|
+
'location',
|
|
2703
|
+
'max-forwards',
|
|
2704
|
+
'proxy-authorization',
|
|
2705
|
+
'referer',
|
|
2706
|
+
'retry-after',
|
|
2707
|
+
'user-agent',
|
|
2592
2708
|
]);
|
|
2593
2709
|
|
|
2594
2710
|
/**
|
|
@@ -2605,47 +2721,81 @@ const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
|
2605
2721
|
*
|
|
2606
2722
|
* @returns {Object} Headers parsed into an object
|
|
2607
2723
|
*/
|
|
2608
|
-
var parseHeaders = rawHeaders => {
|
|
2724
|
+
var parseHeaders = (rawHeaders) => {
|
|
2609
2725
|
const parsed = {};
|
|
2610
2726
|
let key;
|
|
2611
2727
|
let val;
|
|
2612
2728
|
let i;
|
|
2613
2729
|
|
|
2614
|
-
rawHeaders &&
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2730
|
+
rawHeaders &&
|
|
2731
|
+
rawHeaders.split('\n').forEach(function parser(line) {
|
|
2732
|
+
i = line.indexOf(':');
|
|
2733
|
+
key = line.substring(0, i).trim().toLowerCase();
|
|
2734
|
+
val = line.substring(i + 1).trim();
|
|
2618
2735
|
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2736
|
+
if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
|
|
2737
|
+
return;
|
|
2738
|
+
}
|
|
2622
2739
|
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2740
|
+
if (key === 'set-cookie') {
|
|
2741
|
+
if (parsed[key]) {
|
|
2742
|
+
parsed[key].push(val);
|
|
2743
|
+
} else {
|
|
2744
|
+
parsed[key] = [val];
|
|
2745
|
+
}
|
|
2626
2746
|
} else {
|
|
2627
|
-
parsed[key] = [val
|
|
2747
|
+
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
2628
2748
|
}
|
|
2629
|
-
}
|
|
2630
|
-
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
2631
|
-
}
|
|
2632
|
-
});
|
|
2749
|
+
});
|
|
2633
2750
|
|
|
2634
2751
|
return parsed;
|
|
2635
2752
|
};
|
|
2636
2753
|
|
|
2637
2754
|
const $internals = Symbol('internals');
|
|
2638
2755
|
|
|
2756
|
+
const isValidHeaderValue = (value) => !/[\r\n]/.test(value);
|
|
2757
|
+
|
|
2758
|
+
function assertValidHeaderValue(value, header) {
|
|
2759
|
+
if (value === false || value == null) {
|
|
2760
|
+
return;
|
|
2761
|
+
}
|
|
2762
|
+
|
|
2763
|
+
if (utils$1.isArray(value)) {
|
|
2764
|
+
value.forEach((v) => assertValidHeaderValue(v, header));
|
|
2765
|
+
return;
|
|
2766
|
+
}
|
|
2767
|
+
|
|
2768
|
+
if (!isValidHeaderValue(String(value))) {
|
|
2769
|
+
throw new Error(`Invalid character in header content ["${header}"]`);
|
|
2770
|
+
}
|
|
2771
|
+
}
|
|
2772
|
+
|
|
2639
2773
|
function normalizeHeader(header) {
|
|
2640
2774
|
return header && String(header).trim().toLowerCase();
|
|
2641
2775
|
}
|
|
2642
2776
|
|
|
2777
|
+
function stripTrailingCRLF(str) {
|
|
2778
|
+
let end = str.length;
|
|
2779
|
+
|
|
2780
|
+
while (end > 0) {
|
|
2781
|
+
const charCode = str.charCodeAt(end - 1);
|
|
2782
|
+
|
|
2783
|
+
if (charCode !== 10 && charCode !== 13) {
|
|
2784
|
+
break;
|
|
2785
|
+
}
|
|
2786
|
+
|
|
2787
|
+
end -= 1;
|
|
2788
|
+
}
|
|
2789
|
+
|
|
2790
|
+
return end === str.length ? str : str.slice(0, end);
|
|
2791
|
+
}
|
|
2792
|
+
|
|
2643
2793
|
function normalizeValue(value) {
|
|
2644
2794
|
if (value === false || value == null) {
|
|
2645
2795
|
return value;
|
|
2646
2796
|
}
|
|
2647
2797
|
|
|
2648
|
-
return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
2798
|
+
return utils$1.isArray(value) ? value.map(normalizeValue) : stripTrailingCRLF(String(value));
|
|
2649
2799
|
}
|
|
2650
2800
|
|
|
2651
2801
|
function parseTokens(str) {
|
|
@@ -2683,8 +2833,10 @@ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
|
2683
2833
|
}
|
|
2684
2834
|
|
|
2685
2835
|
function formatHeader(header) {
|
|
2686
|
-
return header
|
|
2687
|
-
.
|
|
2836
|
+
return header
|
|
2837
|
+
.trim()
|
|
2838
|
+
.toLowerCase()
|
|
2839
|
+
.replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
|
2688
2840
|
return char.toUpperCase() + str;
|
|
2689
2841
|
});
|
|
2690
2842
|
}
|
|
@@ -2692,12 +2844,12 @@ function formatHeader(header) {
|
|
|
2692
2844
|
function buildAccessors(obj, header) {
|
|
2693
2845
|
const accessorName = utils$1.toCamelCase(' ' + header);
|
|
2694
2846
|
|
|
2695
|
-
['get', 'set', 'has'].forEach(methodName => {
|
|
2847
|
+
['get', 'set', 'has'].forEach((methodName) => {
|
|
2696
2848
|
Object.defineProperty(obj, methodName + accessorName, {
|
|
2697
|
-
value: function(arg1, arg2, arg3) {
|
|
2849
|
+
value: function (arg1, arg2, arg3) {
|
|
2698
2850
|
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
2699
2851
|
},
|
|
2700
|
-
configurable: true
|
|
2852
|
+
configurable: true,
|
|
2701
2853
|
});
|
|
2702
2854
|
});
|
|
2703
2855
|
}
|
|
@@ -2719,7 +2871,13 @@ class AxiosHeaders {
|
|
|
2719
2871
|
|
|
2720
2872
|
const key = utils$1.findKey(self, lHeader);
|
|
2721
2873
|
|
|
2722
|
-
if
|
|
2874
|
+
if (
|
|
2875
|
+
!key ||
|
|
2876
|
+
self[key] === undefined ||
|
|
2877
|
+
_rewrite === true ||
|
|
2878
|
+
(_rewrite === undefined && self[key] !== false)
|
|
2879
|
+
) {
|
|
2880
|
+
assertValidHeaderValue(_value, _header);
|
|
2723
2881
|
self[key || _header] = normalizeValue(_value);
|
|
2724
2882
|
}
|
|
2725
2883
|
}
|
|
@@ -2729,17 +2887,22 @@ class AxiosHeaders {
|
|
|
2729
2887
|
|
|
2730
2888
|
if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
|
|
2731
2889
|
setHeaders(header, valueOrRewrite);
|
|
2732
|
-
} else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
2890
|
+
} else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
2733
2891
|
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
2734
2892
|
} else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
|
|
2735
|
-
let obj = {},
|
|
2893
|
+
let obj = {},
|
|
2894
|
+
dest,
|
|
2895
|
+
key;
|
|
2736
2896
|
for (const entry of header) {
|
|
2737
2897
|
if (!utils$1.isArray(entry)) {
|
|
2738
2898
|
throw TypeError('Object iterator must return a key-value pair');
|
|
2739
2899
|
}
|
|
2740
2900
|
|
|
2741
|
-
obj[key = entry[0]] = (dest = obj[key])
|
|
2742
|
-
|
|
2901
|
+
obj[(key = entry[0])] = (dest = obj[key])
|
|
2902
|
+
? utils$1.isArray(dest)
|
|
2903
|
+
? [...dest, entry[1]]
|
|
2904
|
+
: [dest, entry[1]]
|
|
2905
|
+
: entry[1];
|
|
2743
2906
|
}
|
|
2744
2907
|
|
|
2745
2908
|
setHeaders(obj, valueOrRewrite);
|
|
@@ -2786,7 +2949,11 @@ class AxiosHeaders {
|
|
|
2786
2949
|
if (header) {
|
|
2787
2950
|
const key = utils$1.findKey(this, header);
|
|
2788
2951
|
|
|
2789
|
-
return !!(
|
|
2952
|
+
return !!(
|
|
2953
|
+
key &&
|
|
2954
|
+
this[key] !== undefined &&
|
|
2955
|
+
(!matcher || matchHeaderValue(this, this[key], key, matcher))
|
|
2956
|
+
);
|
|
2790
2957
|
}
|
|
2791
2958
|
|
|
2792
2959
|
return false;
|
|
@@ -2826,7 +2993,7 @@ class AxiosHeaders {
|
|
|
2826
2993
|
|
|
2827
2994
|
while (i--) {
|
|
2828
2995
|
const key = keys[i];
|
|
2829
|
-
if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
2996
|
+
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
2830
2997
|
delete this[key];
|
|
2831
2998
|
deleted = true;
|
|
2832
2999
|
}
|
|
@@ -2870,7 +3037,9 @@ class AxiosHeaders {
|
|
|
2870
3037
|
const obj = Object.create(null);
|
|
2871
3038
|
|
|
2872
3039
|
utils$1.forEach(this, (value, header) => {
|
|
2873
|
-
value != null &&
|
|
3040
|
+
value != null &&
|
|
3041
|
+
value !== false &&
|
|
3042
|
+
(obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
|
|
2874
3043
|
});
|
|
2875
3044
|
|
|
2876
3045
|
return obj;
|
|
@@ -2881,11 +3050,13 @@ class AxiosHeaders {
|
|
|
2881
3050
|
}
|
|
2882
3051
|
|
|
2883
3052
|
toString() {
|
|
2884
|
-
return Object.entries(this.toJSON())
|
|
3053
|
+
return Object.entries(this.toJSON())
|
|
3054
|
+
.map(([header, value]) => header + ': ' + value)
|
|
3055
|
+
.join('\n');
|
|
2885
3056
|
}
|
|
2886
3057
|
|
|
2887
3058
|
getSetCookie() {
|
|
2888
|
-
return this.get(
|
|
3059
|
+
return this.get('set-cookie') || [];
|
|
2889
3060
|
}
|
|
2890
3061
|
|
|
2891
3062
|
get [Symbol.toStringTag]() {
|
|
@@ -2905,9 +3076,12 @@ class AxiosHeaders {
|
|
|
2905
3076
|
}
|
|
2906
3077
|
|
|
2907
3078
|
static accessor(header) {
|
|
2908
|
-
const internals =
|
|
2909
|
-
|
|
2910
|
-
|
|
3079
|
+
const internals =
|
|
3080
|
+
(this[$internals] =
|
|
3081
|
+
this[$internals] =
|
|
3082
|
+
{
|
|
3083
|
+
accessors: {},
|
|
3084
|
+
});
|
|
2911
3085
|
|
|
2912
3086
|
const accessors = internals.accessors;
|
|
2913
3087
|
const prototype = this.prototype;
|
|
@@ -2927,23 +3101,28 @@ class AxiosHeaders {
|
|
|
2927
3101
|
}
|
|
2928
3102
|
}
|
|
2929
3103
|
|
|
2930
|
-
AxiosHeaders.accessor([
|
|
3104
|
+
AxiosHeaders.accessor([
|
|
3105
|
+
'Content-Type',
|
|
3106
|
+
'Content-Length',
|
|
3107
|
+
'Accept',
|
|
3108
|
+
'Accept-Encoding',
|
|
3109
|
+
'User-Agent',
|
|
3110
|
+
'Authorization',
|
|
3111
|
+
]);
|
|
2931
3112
|
|
|
2932
3113
|
// reserved names hotfix
|
|
2933
|
-
utils$1.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
|
|
3114
|
+
utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
|
|
2934
3115
|
let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
|
|
2935
3116
|
return {
|
|
2936
3117
|
get: () => value,
|
|
2937
3118
|
set(headerValue) {
|
|
2938
3119
|
this[mapped] = headerValue;
|
|
2939
|
-
}
|
|
2940
|
-
}
|
|
3120
|
+
},
|
|
3121
|
+
};
|
|
2941
3122
|
});
|
|
2942
3123
|
|
|
2943
3124
|
utils$1.freezeMethods(AxiosHeaders);
|
|
2944
3125
|
|
|
2945
|
-
var AxiosHeaders$1 = AxiosHeaders;
|
|
2946
|
-
|
|
2947
3126
|
/**
|
|
2948
3127
|
* Transform the data for a request or a response
|
|
2949
3128
|
*
|
|
@@ -2953,9 +3132,9 @@ var AxiosHeaders$1 = AxiosHeaders;
|
|
|
2953
3132
|
* @returns {*} The resulting transformed data
|
|
2954
3133
|
*/
|
|
2955
3134
|
function transformData(fns, response) {
|
|
2956
|
-
const config = this || defaults
|
|
3135
|
+
const config = this || defaults;
|
|
2957
3136
|
const context = response || config;
|
|
2958
|
-
const headers = AxiosHeaders
|
|
3137
|
+
const headers = AxiosHeaders.from(context.headers);
|
|
2959
3138
|
let data = context.data;
|
|
2960
3139
|
|
|
2961
3140
|
utils$1.forEach(fns, function transform(fn) {
|
|
@@ -2971,7 +3150,7 @@ function isCancel(value) {
|
|
|
2971
3150
|
return !!(value && value.__CANCEL__);
|
|
2972
3151
|
}
|
|
2973
3152
|
|
|
2974
|
-
class CanceledError extends AxiosError
|
|
3153
|
+
class CanceledError extends AxiosError {
|
|
2975
3154
|
/**
|
|
2976
3155
|
* A `CanceledError` is an object that is thrown when an operation is canceled.
|
|
2977
3156
|
*
|
|
@@ -2982,14 +3161,12 @@ class CanceledError extends AxiosError$1 {
|
|
|
2982
3161
|
* @returns {CanceledError} The created error.
|
|
2983
3162
|
*/
|
|
2984
3163
|
constructor(message, config, request) {
|
|
2985
|
-
super(message == null ? 'canceled' : message, AxiosError
|
|
3164
|
+
super(message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
|
|
2986
3165
|
this.name = 'CanceledError';
|
|
2987
3166
|
this.__CANCEL__ = true;
|
|
2988
3167
|
}
|
|
2989
3168
|
}
|
|
2990
3169
|
|
|
2991
|
-
var CanceledError$1 = CanceledError;
|
|
2992
|
-
|
|
2993
3170
|
/**
|
|
2994
3171
|
* Resolve or reject a Promise based on response status.
|
|
2995
3172
|
*
|
|
@@ -3004,19 +3181,23 @@ function settle(resolve, reject, response) {
|
|
|
3004
3181
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
3005
3182
|
resolve(response);
|
|
3006
3183
|
} else {
|
|
3007
|
-
reject(
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3184
|
+
reject(
|
|
3185
|
+
new AxiosError(
|
|
3186
|
+
'Request failed with status code ' + response.status,
|
|
3187
|
+
[AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][
|
|
3188
|
+
Math.floor(response.status / 100) - 4
|
|
3189
|
+
],
|
|
3190
|
+
response.config,
|
|
3191
|
+
response.request,
|
|
3192
|
+
response
|
|
3193
|
+
)
|
|
3194
|
+
);
|
|
3014
3195
|
}
|
|
3015
3196
|
}
|
|
3016
3197
|
|
|
3017
3198
|
function parseProtocol(url) {
|
|
3018
3199
|
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
3019
|
-
return match && match[1] || '';
|
|
3200
|
+
return (match && match[1]) || '';
|
|
3020
3201
|
}
|
|
3021
3202
|
|
|
3022
3203
|
/**
|
|
@@ -3067,7 +3248,7 @@ function speedometer(samplesCount, min) {
|
|
|
3067
3248
|
|
|
3068
3249
|
const passed = startedAt && now - startedAt;
|
|
3069
3250
|
|
|
3070
|
-
return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
|
|
3251
|
+
return passed ? Math.round((bytesCount * 1000) / passed) : undefined;
|
|
3071
3252
|
};
|
|
3072
3253
|
}
|
|
3073
3254
|
|
|
@@ -3096,7 +3277,7 @@ function throttle(fn, freq) {
|
|
|
3096
3277
|
const throttled = (...args) => {
|
|
3097
3278
|
const now = Date.now();
|
|
3098
3279
|
const passed = now - timestamp;
|
|
3099
|
-
if (
|
|
3280
|
+
if (passed >= threshold) {
|
|
3100
3281
|
invoke(args, now);
|
|
3101
3282
|
} else {
|
|
3102
3283
|
lastArgs = args;
|
|
@@ -3118,7 +3299,7 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
|
3118
3299
|
let bytesNotified = 0;
|
|
3119
3300
|
const _speedometer = speedometer(50, 250);
|
|
3120
3301
|
|
|
3121
|
-
return throttle(e => {
|
|
3302
|
+
return throttle((e) => {
|
|
3122
3303
|
const loaded = e.loaded;
|
|
3123
3304
|
const total = e.lengthComputable ? e.total : undefined;
|
|
3124
3305
|
const progressBytes = loaded - bytesNotified;
|
|
@@ -3130,13 +3311,13 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
|
3130
3311
|
const data = {
|
|
3131
3312
|
loaded,
|
|
3132
3313
|
total,
|
|
3133
|
-
progress: total ?
|
|
3314
|
+
progress: total ? loaded / total : undefined,
|
|
3134
3315
|
bytes: progressBytes,
|
|
3135
3316
|
rate: rate ? rate : undefined,
|
|
3136
3317
|
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
|
3137
3318
|
event: e,
|
|
3138
3319
|
lengthComputable: total != null,
|
|
3139
|
-
[isDownloadStream ? 'download' : 'upload']: true
|
|
3320
|
+
[isDownloadStream ? 'download' : 'upload']: true,
|
|
3140
3321
|
};
|
|
3141
3322
|
|
|
3142
3323
|
listener(data);
|
|
@@ -3146,77 +3327,82 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
|
3146
3327
|
const progressEventDecorator = (total, throttled) => {
|
|
3147
3328
|
const lengthComputable = total != null;
|
|
3148
3329
|
|
|
3149
|
-
return [
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3330
|
+
return [
|
|
3331
|
+
(loaded) =>
|
|
3332
|
+
throttled[0]({
|
|
3333
|
+
lengthComputable,
|
|
3334
|
+
total,
|
|
3335
|
+
loaded,
|
|
3336
|
+
}),
|
|
3337
|
+
throttled[1],
|
|
3338
|
+
];
|
|
3154
3339
|
};
|
|
3155
3340
|
|
|
3156
|
-
const asyncDecorator =
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
return (
|
|
3162
|
-
origin.protocol === url.protocol &&
|
|
3163
|
-
origin.host === url.host &&
|
|
3164
|
-
(isMSIE || origin.port === url.port)
|
|
3165
|
-
);
|
|
3166
|
-
})(
|
|
3167
|
-
new URL(platform.origin),
|
|
3168
|
-
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
|
3169
|
-
) : () => true;
|
|
3170
|
-
|
|
3171
|
-
var cookies = platform.hasStandardBrowserEnv ?
|
|
3341
|
+
const asyncDecorator =
|
|
3342
|
+
(fn) =>
|
|
3343
|
+
(...args) =>
|
|
3344
|
+
utils$1.asap(() => fn(...args));
|
|
3172
3345
|
|
|
3173
|
-
|
|
3174
|
-
{
|
|
3175
|
-
|
|
3176
|
-
if (typeof document === 'undefined') return;
|
|
3346
|
+
var isURLSameOrigin = platform.hasStandardBrowserEnv
|
|
3347
|
+
? ((origin, isMSIE) => (url) => {
|
|
3348
|
+
url = new URL(url, platform.origin);
|
|
3177
3349
|
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3350
|
+
return (
|
|
3351
|
+
origin.protocol === url.protocol &&
|
|
3352
|
+
origin.host === url.host &&
|
|
3353
|
+
(isMSIE || origin.port === url.port)
|
|
3354
|
+
);
|
|
3355
|
+
})(
|
|
3356
|
+
new URL(platform.origin),
|
|
3357
|
+
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
|
3358
|
+
)
|
|
3359
|
+
: () => true;
|
|
3360
|
+
|
|
3361
|
+
var cookies = platform.hasStandardBrowserEnv
|
|
3362
|
+
? // Standard browser envs support document.cookie
|
|
3363
|
+
{
|
|
3364
|
+
write(name, value, expires, path, domain, secure, sameSite) {
|
|
3365
|
+
if (typeof document === 'undefined') return;
|
|
3366
|
+
|
|
3367
|
+
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
3368
|
+
|
|
3369
|
+
if (utils$1.isNumber(expires)) {
|
|
3370
|
+
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
3371
|
+
}
|
|
3372
|
+
if (utils$1.isString(path)) {
|
|
3373
|
+
cookie.push(`path=${path}`);
|
|
3374
|
+
}
|
|
3375
|
+
if (utils$1.isString(domain)) {
|
|
3376
|
+
cookie.push(`domain=${domain}`);
|
|
3377
|
+
}
|
|
3378
|
+
if (secure === true) {
|
|
3379
|
+
cookie.push('secure');
|
|
3380
|
+
}
|
|
3381
|
+
if (utils$1.isString(sameSite)) {
|
|
3382
|
+
cookie.push(`SameSite=${sameSite}`);
|
|
3383
|
+
}
|
|
3195
3384
|
|
|
3196
|
-
|
|
3197
|
-
|
|
3385
|
+
document.cookie = cookie.join('; ');
|
|
3386
|
+
},
|
|
3198
3387
|
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3388
|
+
read(name) {
|
|
3389
|
+
if (typeof document === 'undefined') return null;
|
|
3390
|
+
const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
|
|
3391
|
+
return match ? decodeURIComponent(match[1]) : null;
|
|
3392
|
+
},
|
|
3204
3393
|
|
|
3205
|
-
|
|
3206
|
-
|
|
3394
|
+
remove(name) {
|
|
3395
|
+
this.write(name, '', Date.now() - 86400000, '/');
|
|
3396
|
+
},
|
|
3207
3397
|
}
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
return null;
|
|
3217
|
-
},
|
|
3218
|
-
remove() {}
|
|
3219
|
-
};
|
|
3398
|
+
: // Non-standard browser env (web workers, react-native) lack needed support.
|
|
3399
|
+
{
|
|
3400
|
+
write() {},
|
|
3401
|
+
read() {
|
|
3402
|
+
return null;
|
|
3403
|
+
},
|
|
3404
|
+
remove() {},
|
|
3405
|
+
};
|
|
3220
3406
|
|
|
3221
3407
|
/**
|
|
3222
3408
|
* Determines whether the specified URL is absolute
|
|
@@ -3268,8 +3454,7 @@ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
|
3268
3454
|
return requestedURL;
|
|
3269
3455
|
}
|
|
3270
3456
|
|
|
3271
|
-
const headersToObject = (thing) =>
|
|
3272
|
-
thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
|
|
3457
|
+
const headersToObject = (thing) => (thing instanceof AxiosHeaders ? { ...thing } : thing);
|
|
3273
3458
|
|
|
3274
3459
|
/**
|
|
3275
3460
|
* Config-specific merge-function which creates a new config-object
|
|
@@ -3362,23 +3547,12 @@ function mergeConfig(config1, config2) {
|
|
|
3362
3547
|
mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true),
|
|
3363
3548
|
};
|
|
3364
3549
|
|
|
3365
|
-
utils$1.forEach(
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
prop === "prototype"
|
|
3372
|
-
)
|
|
3373
|
-
return;
|
|
3374
|
-
const merge = utils$1.hasOwnProp(mergeMap, prop)
|
|
3375
|
-
? mergeMap[prop]
|
|
3376
|
-
: mergeDeepProperties;
|
|
3377
|
-
const configValue = merge(config1[prop], config2[prop], prop);
|
|
3378
|
-
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) ||
|
|
3379
|
-
(config[prop] = configValue);
|
|
3380
|
-
},
|
|
3381
|
-
);
|
|
3550
|
+
utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
|
|
3551
|
+
if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
|
|
3552
|
+
const merge = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
|
|
3553
|
+
const configValue = merge(config1[prop], config2[prop], prop);
|
|
3554
|
+
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
3555
|
+
});
|
|
3382
3556
|
|
|
3383
3557
|
return config;
|
|
3384
3558
|
}
|
|
@@ -3388,14 +3562,24 @@ var resolveConfig = (config) => {
|
|
|
3388
3562
|
|
|
3389
3563
|
let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
|
|
3390
3564
|
|
|
3391
|
-
newConfig.headers = headers = AxiosHeaders
|
|
3565
|
+
newConfig.headers = headers = AxiosHeaders.from(headers);
|
|
3392
3566
|
|
|
3393
|
-
newConfig.url = buildURL(
|
|
3567
|
+
newConfig.url = buildURL(
|
|
3568
|
+
buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls),
|
|
3569
|
+
config.params,
|
|
3570
|
+
config.paramsSerializer
|
|
3571
|
+
);
|
|
3394
3572
|
|
|
3395
3573
|
// HTTP basic authentication
|
|
3396
3574
|
if (auth) {
|
|
3397
|
-
headers.set(
|
|
3398
|
-
|
|
3575
|
+
headers.set(
|
|
3576
|
+
'Authorization',
|
|
3577
|
+
'Basic ' +
|
|
3578
|
+
btoa(
|
|
3579
|
+
(auth.username || '') +
|
|
3580
|
+
':' +
|
|
3581
|
+
(auth.password ? unescape(encodeURIComponent(auth.password)) : '')
|
|
3582
|
+
)
|
|
3399
3583
|
);
|
|
3400
3584
|
}
|
|
3401
3585
|
|
|
@@ -3413,7 +3597,7 @@ var resolveConfig = (config) => {
|
|
|
3413
3597
|
}
|
|
3414
3598
|
});
|
|
3415
3599
|
}
|
|
3416
|
-
}
|
|
3600
|
+
}
|
|
3417
3601
|
|
|
3418
3602
|
// Add xsrf header
|
|
3419
3603
|
// This is only done if running in a standard browser environment.
|
|
@@ -3437,196 +3621,218 @@ var resolveConfig = (config) => {
|
|
|
3437
3621
|
|
|
3438
3622
|
const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
|
3439
3623
|
|
|
3440
|
-
var xhrAdapter = isXHRAdapterSupported &&
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3624
|
+
var xhrAdapter = isXHRAdapterSupported &&
|
|
3625
|
+
function (config) {
|
|
3626
|
+
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
3627
|
+
const _config = resolveConfig(config);
|
|
3628
|
+
let requestData = _config.data;
|
|
3629
|
+
const requestHeaders = AxiosHeaders.from(_config.headers).normalize();
|
|
3630
|
+
let { responseType, onUploadProgress, onDownloadProgress } = _config;
|
|
3631
|
+
let onCanceled;
|
|
3632
|
+
let uploadThrottled, downloadThrottled;
|
|
3633
|
+
let flushUpload, flushDownload;
|
|
3449
3634
|
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3635
|
+
function done() {
|
|
3636
|
+
flushUpload && flushUpload(); // flush events
|
|
3637
|
+
flushDownload && flushDownload(); // flush events
|
|
3453
3638
|
|
|
3454
|
-
|
|
3639
|
+
_config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
|
|
3455
3640
|
|
|
3456
|
-
|
|
3457
|
-
|
|
3641
|
+
_config.signal && _config.signal.removeEventListener('abort', onCanceled);
|
|
3642
|
+
}
|
|
3458
3643
|
|
|
3459
|
-
|
|
3644
|
+
let request = new XMLHttpRequest();
|
|
3460
3645
|
|
|
3461
|
-
|
|
3646
|
+
request.open(_config.method.toUpperCase(), _config.url, true);
|
|
3462
3647
|
|
|
3463
|
-
|
|
3464
|
-
|
|
3648
|
+
// Set the request timeout in MS
|
|
3649
|
+
request.timeout = _config.timeout;
|
|
3465
3650
|
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3651
|
+
function onloadend() {
|
|
3652
|
+
if (!request) {
|
|
3653
|
+
return;
|
|
3654
|
+
}
|
|
3655
|
+
// Prepare the response
|
|
3656
|
+
const responseHeaders = AxiosHeaders.from(
|
|
3657
|
+
'getAllResponseHeaders' in request && request.getAllResponseHeaders()
|
|
3658
|
+
);
|
|
3659
|
+
const responseData =
|
|
3660
|
+
!responseType || responseType === 'text' || responseType === 'json'
|
|
3661
|
+
? request.responseText
|
|
3662
|
+
: request.response;
|
|
3663
|
+
const response = {
|
|
3664
|
+
data: responseData,
|
|
3665
|
+
status: request.status,
|
|
3666
|
+
statusText: request.statusText,
|
|
3667
|
+
headers: responseHeaders,
|
|
3668
|
+
config,
|
|
3669
|
+
request,
|
|
3670
|
+
};
|
|
3671
|
+
|
|
3672
|
+
settle(
|
|
3673
|
+
function _resolve(value) {
|
|
3674
|
+
resolve(value);
|
|
3675
|
+
done();
|
|
3676
|
+
},
|
|
3677
|
+
function _reject(err) {
|
|
3678
|
+
reject(err);
|
|
3679
|
+
done();
|
|
3680
|
+
},
|
|
3681
|
+
response
|
|
3682
|
+
);
|
|
3683
|
+
|
|
3684
|
+
// Clean up request
|
|
3685
|
+
request = null;
|
|
3469
3686
|
}
|
|
3470
|
-
// Prepare the response
|
|
3471
|
-
const responseHeaders = AxiosHeaders$1.from(
|
|
3472
|
-
'getAllResponseHeaders' in request && request.getAllResponseHeaders()
|
|
3473
|
-
);
|
|
3474
|
-
const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
|
|
3475
|
-
request.responseText : request.response;
|
|
3476
|
-
const response = {
|
|
3477
|
-
data: responseData,
|
|
3478
|
-
status: request.status,
|
|
3479
|
-
statusText: request.statusText,
|
|
3480
|
-
headers: responseHeaders,
|
|
3481
|
-
config,
|
|
3482
|
-
request
|
|
3483
|
-
};
|
|
3484
3687
|
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
}
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3688
|
+
if ('onloadend' in request) {
|
|
3689
|
+
// Use onloadend if available
|
|
3690
|
+
request.onloadend = onloadend;
|
|
3691
|
+
} else {
|
|
3692
|
+
// Listen for ready state to emulate onloadend
|
|
3693
|
+
request.onreadystatechange = function handleLoad() {
|
|
3694
|
+
if (!request || request.readyState !== 4) {
|
|
3695
|
+
return;
|
|
3696
|
+
}
|
|
3492
3697
|
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3698
|
+
// The request errored out and we didn't get a response, this will be
|
|
3699
|
+
// handled by onerror instead
|
|
3700
|
+
// With one exception: request that using file: protocol, most browsers
|
|
3701
|
+
// will return status as 0 even though it's a successful request
|
|
3702
|
+
if (
|
|
3703
|
+
request.status === 0 &&
|
|
3704
|
+
!(request.responseURL && request.responseURL.indexOf('file:') === 0)
|
|
3705
|
+
) {
|
|
3706
|
+
return;
|
|
3707
|
+
}
|
|
3708
|
+
// readystate handler is calling before onerror or ontimeout handlers,
|
|
3709
|
+
// so we should call onloadend on the next 'tick'
|
|
3710
|
+
setTimeout(onloadend);
|
|
3711
|
+
};
|
|
3712
|
+
}
|
|
3496
3713
|
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
} else {
|
|
3501
|
-
// Listen for ready state to emulate onloadend
|
|
3502
|
-
request.onreadystatechange = function handleLoad() {
|
|
3503
|
-
if (!request || request.readyState !== 4) {
|
|
3714
|
+
// Handle browser request cancellation (as opposed to a manual cancellation)
|
|
3715
|
+
request.onabort = function handleAbort() {
|
|
3716
|
+
if (!request) {
|
|
3504
3717
|
return;
|
|
3505
3718
|
}
|
|
3506
3719
|
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
//
|
|
3510
|
-
|
|
3511
|
-
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
|
|
3512
|
-
return;
|
|
3513
|
-
}
|
|
3514
|
-
// readystate handler is calling before onerror or ontimeout handlers,
|
|
3515
|
-
// so we should call onloadend on the next 'tick'
|
|
3516
|
-
setTimeout(onloadend);
|
|
3720
|
+
reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
|
|
3721
|
+
|
|
3722
|
+
// Clean up request
|
|
3723
|
+
request = null;
|
|
3517
3724
|
};
|
|
3518
|
-
}
|
|
3519
3725
|
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3726
|
+
// Handle low level network errors
|
|
3727
|
+
request.onerror = function handleError(event) {
|
|
3728
|
+
// Browsers deliver a ProgressEvent in XHR onerror
|
|
3729
|
+
// (message may be empty; when present, surface it)
|
|
3730
|
+
// See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
|
|
3731
|
+
const msg = event && event.message ? event.message : 'Network Error';
|
|
3732
|
+
const err = new AxiosError(msg, AxiosError.ERR_NETWORK, config, request);
|
|
3733
|
+
// attach the underlying event for consumers who want details
|
|
3734
|
+
err.event = event || null;
|
|
3735
|
+
reject(err);
|
|
3736
|
+
request = null;
|
|
3737
|
+
};
|
|
3525
3738
|
|
|
3526
|
-
|
|
3739
|
+
// Handle timeout
|
|
3740
|
+
request.ontimeout = function handleTimeout() {
|
|
3741
|
+
let timeoutErrorMessage = _config.timeout
|
|
3742
|
+
? 'timeout of ' + _config.timeout + 'ms exceeded'
|
|
3743
|
+
: 'timeout exceeded';
|
|
3744
|
+
const transitional = _config.transitional || transitionalDefaults;
|
|
3745
|
+
if (_config.timeoutErrorMessage) {
|
|
3746
|
+
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
3747
|
+
}
|
|
3748
|
+
reject(
|
|
3749
|
+
new AxiosError(
|
|
3750
|
+
timeoutErrorMessage,
|
|
3751
|
+
transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
|
|
3752
|
+
config,
|
|
3753
|
+
request
|
|
3754
|
+
)
|
|
3755
|
+
);
|
|
3527
3756
|
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3757
|
+
// Clean up request
|
|
3758
|
+
request = null;
|
|
3759
|
+
};
|
|
3531
3760
|
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
// Browsers deliver a ProgressEvent in XHR onerror
|
|
3535
|
-
// (message may be empty; when present, surface it)
|
|
3536
|
-
// See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
|
|
3537
|
-
const msg = event && event.message ? event.message : 'Network Error';
|
|
3538
|
-
const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
|
|
3539
|
-
// attach the underlying event for consumers who want details
|
|
3540
|
-
err.event = event || null;
|
|
3541
|
-
reject(err);
|
|
3542
|
-
request = null;
|
|
3543
|
-
};
|
|
3544
|
-
|
|
3545
|
-
// Handle timeout
|
|
3546
|
-
request.ontimeout = function handleTimeout() {
|
|
3547
|
-
let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
|
|
3548
|
-
const transitional = _config.transitional || transitionalDefaults;
|
|
3549
|
-
if (_config.timeoutErrorMessage) {
|
|
3550
|
-
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
3551
|
-
}
|
|
3552
|
-
reject(new AxiosError$1(
|
|
3553
|
-
timeoutErrorMessage,
|
|
3554
|
-
transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
|
|
3555
|
-
config,
|
|
3556
|
-
request));
|
|
3557
|
-
|
|
3558
|
-
// Clean up request
|
|
3559
|
-
request = null;
|
|
3560
|
-
};
|
|
3761
|
+
// Remove Content-Type if data is undefined
|
|
3762
|
+
requestData === undefined && requestHeaders.setContentType(null);
|
|
3561
3763
|
|
|
3562
|
-
|
|
3563
|
-
|
|
3764
|
+
// Add headers to the request
|
|
3765
|
+
if ('setRequestHeader' in request) {
|
|
3766
|
+
utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
|
3767
|
+
request.setRequestHeader(key, val);
|
|
3768
|
+
});
|
|
3769
|
+
}
|
|
3564
3770
|
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
});
|
|
3570
|
-
}
|
|
3771
|
+
// Add withCredentials to request if needed
|
|
3772
|
+
if (!utils$1.isUndefined(_config.withCredentials)) {
|
|
3773
|
+
request.withCredentials = !!_config.withCredentials;
|
|
3774
|
+
}
|
|
3571
3775
|
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3776
|
+
// Add responseType to request if needed
|
|
3777
|
+
if (responseType && responseType !== 'json') {
|
|
3778
|
+
request.responseType = _config.responseType;
|
|
3779
|
+
}
|
|
3576
3780
|
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3781
|
+
// Handle progress if needed
|
|
3782
|
+
if (onDownloadProgress) {
|
|
3783
|
+
[downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
|
|
3784
|
+
request.addEventListener('progress', downloadThrottled);
|
|
3785
|
+
}
|
|
3581
3786
|
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
request.addEventListener('progress', downloadThrottled);
|
|
3586
|
-
}
|
|
3787
|
+
// Not all browsers support upload events
|
|
3788
|
+
if (onUploadProgress && request.upload) {
|
|
3789
|
+
[uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
|
|
3587
3790
|
|
|
3588
|
-
|
|
3589
|
-
if (onUploadProgress && request.upload) {
|
|
3590
|
-
([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress));
|
|
3791
|
+
request.upload.addEventListener('progress', uploadThrottled);
|
|
3591
3792
|
|
|
3592
|
-
|
|
3793
|
+
request.upload.addEventListener('loadend', flushUpload);
|
|
3794
|
+
}
|
|
3593
3795
|
|
|
3594
|
-
|
|
3595
|
-
|
|
3796
|
+
if (_config.cancelToken || _config.signal) {
|
|
3797
|
+
// Handle cancellation
|
|
3798
|
+
// eslint-disable-next-line func-names
|
|
3799
|
+
onCanceled = (cancel) => {
|
|
3800
|
+
if (!request) {
|
|
3801
|
+
return;
|
|
3802
|
+
}
|
|
3803
|
+
reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
|
|
3804
|
+
request.abort();
|
|
3805
|
+
request = null;
|
|
3806
|
+
};
|
|
3596
3807
|
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
return;
|
|
3808
|
+
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
|
3809
|
+
if (_config.signal) {
|
|
3810
|
+
_config.signal.aborted
|
|
3811
|
+
? onCanceled()
|
|
3812
|
+
: _config.signal.addEventListener('abort', onCanceled);
|
|
3603
3813
|
}
|
|
3604
|
-
reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
|
|
3605
|
-
request.abort();
|
|
3606
|
-
request = null;
|
|
3607
|
-
};
|
|
3608
|
-
|
|
3609
|
-
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
|
3610
|
-
if (_config.signal) {
|
|
3611
|
-
_config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
|
|
3612
3814
|
}
|
|
3613
|
-
}
|
|
3614
3815
|
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
3618
|
-
reject(new AxiosError$1('Unsupported protocol ' + protocol + ':', AxiosError$1.ERR_BAD_REQUEST, config));
|
|
3619
|
-
return;
|
|
3620
|
-
}
|
|
3816
|
+
const protocol = parseProtocol(_config.url);
|
|
3621
3817
|
|
|
3818
|
+
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
3819
|
+
reject(
|
|
3820
|
+
new AxiosError(
|
|
3821
|
+
'Unsupported protocol ' + protocol + ':',
|
|
3822
|
+
AxiosError.ERR_BAD_REQUEST,
|
|
3823
|
+
config
|
|
3824
|
+
)
|
|
3825
|
+
);
|
|
3826
|
+
return;
|
|
3827
|
+
}
|
|
3622
3828
|
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
};
|
|
3829
|
+
// Send the request
|
|
3830
|
+
request.send(requestData || null);
|
|
3831
|
+
});
|
|
3832
|
+
};
|
|
3627
3833
|
|
|
3628
3834
|
const composeSignals = (signals, timeout) => {
|
|
3629
|
-
const {length} = (signals = signals ? signals.filter(Boolean) : []);
|
|
3835
|
+
const { length } = (signals = signals ? signals.filter(Boolean) : []);
|
|
3630
3836
|
|
|
3631
3837
|
if (timeout || length) {
|
|
3632
3838
|
let controller = new AbortController();
|
|
@@ -3638,21 +3844,29 @@ const composeSignals = (signals, timeout) => {
|
|
|
3638
3844
|
aborted = true;
|
|
3639
3845
|
unsubscribe();
|
|
3640
3846
|
const err = reason instanceof Error ? reason : this.reason;
|
|
3641
|
-
controller.abort(
|
|
3847
|
+
controller.abort(
|
|
3848
|
+
err instanceof AxiosError
|
|
3849
|
+
? err
|
|
3850
|
+
: new CanceledError(err instanceof Error ? err.message : err)
|
|
3851
|
+
);
|
|
3642
3852
|
}
|
|
3643
3853
|
};
|
|
3644
3854
|
|
|
3645
|
-
let timer =
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3855
|
+
let timer =
|
|
3856
|
+
timeout &&
|
|
3857
|
+
setTimeout(() => {
|
|
3858
|
+
timer = null;
|
|
3859
|
+
onabort(new AxiosError(`timeout of ${timeout}ms exceeded`, AxiosError.ETIMEDOUT));
|
|
3860
|
+
}, timeout);
|
|
3649
3861
|
|
|
3650
3862
|
const unsubscribe = () => {
|
|
3651
3863
|
if (signals) {
|
|
3652
3864
|
timer && clearTimeout(timer);
|
|
3653
3865
|
timer = null;
|
|
3654
|
-
signals.forEach(signal => {
|
|
3655
|
-
signal.unsubscribe
|
|
3866
|
+
signals.forEach((signal) => {
|
|
3867
|
+
signal.unsubscribe
|
|
3868
|
+
? signal.unsubscribe(onabort)
|
|
3869
|
+
: signal.removeEventListener('abort', onabort);
|
|
3656
3870
|
});
|
|
3657
3871
|
signals = null;
|
|
3658
3872
|
}
|
|
@@ -3660,7 +3874,7 @@ const composeSignals = (signals, timeout) => {
|
|
|
3660
3874
|
|
|
3661
3875
|
signals.forEach((signal) => signal.addEventListener('abort', onabort));
|
|
3662
3876
|
|
|
3663
|
-
const {signal} = controller;
|
|
3877
|
+
const { signal } = controller;
|
|
3664
3878
|
|
|
3665
3879
|
signal.unsubscribe = () => utils$1.asap(unsubscribe);
|
|
3666
3880
|
|
|
@@ -3668,12 +3882,10 @@ const composeSignals = (signals, timeout) => {
|
|
|
3668
3882
|
}
|
|
3669
3883
|
};
|
|
3670
3884
|
|
|
3671
|
-
var composeSignals$1 = composeSignals;
|
|
3672
|
-
|
|
3673
3885
|
const streamChunk = function* (chunk, chunkSize) {
|
|
3674
3886
|
let len = chunk.byteLength;
|
|
3675
3887
|
|
|
3676
|
-
if (
|
|
3888
|
+
if (len < chunkSize) {
|
|
3677
3889
|
yield chunk;
|
|
3678
3890
|
return;
|
|
3679
3891
|
}
|
|
@@ -3703,7 +3915,7 @@ const readStream = async function* (stream) {
|
|
|
3703
3915
|
const reader = stream.getReader();
|
|
3704
3916
|
try {
|
|
3705
3917
|
for (;;) {
|
|
3706
|
-
const {done, value} = await reader.read();
|
|
3918
|
+
const { done, value } = await reader.read();
|
|
3707
3919
|
if (done) {
|
|
3708
3920
|
break;
|
|
3709
3921
|
}
|
|
@@ -3726,64 +3938,69 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
|
3726
3938
|
}
|
|
3727
3939
|
};
|
|
3728
3940
|
|
|
3729
|
-
return new ReadableStream(
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3941
|
+
return new ReadableStream(
|
|
3942
|
+
{
|
|
3943
|
+
async pull(controller) {
|
|
3944
|
+
try {
|
|
3945
|
+
const { done, value } = await iterator.next();
|
|
3733
3946
|
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3947
|
+
if (done) {
|
|
3948
|
+
_onFinish();
|
|
3949
|
+
controller.close();
|
|
3950
|
+
return;
|
|
3951
|
+
}
|
|
3739
3952
|
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3953
|
+
let len = value.byteLength;
|
|
3954
|
+
if (onProgress) {
|
|
3955
|
+
let loadedBytes = (bytes += len);
|
|
3956
|
+
onProgress(loadedBytes);
|
|
3957
|
+
}
|
|
3958
|
+
controller.enqueue(new Uint8Array(value));
|
|
3959
|
+
} catch (err) {
|
|
3960
|
+
_onFinish(err);
|
|
3961
|
+
throw err;
|
|
3744
3962
|
}
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
_onFinish(
|
|
3748
|
-
|
|
3749
|
-
}
|
|
3963
|
+
},
|
|
3964
|
+
cancel(reason) {
|
|
3965
|
+
_onFinish(reason);
|
|
3966
|
+
return iterator.return();
|
|
3967
|
+
},
|
|
3750
3968
|
},
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
return iterator.return();
|
|
3969
|
+
{
|
|
3970
|
+
highWaterMark: 2,
|
|
3754
3971
|
}
|
|
3755
|
-
|
|
3756
|
-
highWaterMark: 2
|
|
3757
|
-
})
|
|
3972
|
+
);
|
|
3758
3973
|
};
|
|
3759
3974
|
|
|
3760
3975
|
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
3761
3976
|
|
|
3762
|
-
const {isFunction} = utils$1;
|
|
3977
|
+
const { isFunction } = utils$1;
|
|
3763
3978
|
|
|
3764
|
-
const globalFetchAPI = (({Request, Response}) => ({
|
|
3765
|
-
Request,
|
|
3979
|
+
const globalFetchAPI = (({ Request, Response }) => ({
|
|
3980
|
+
Request,
|
|
3981
|
+
Response,
|
|
3766
3982
|
}))(utils$1.global);
|
|
3767
3983
|
|
|
3768
|
-
const {
|
|
3769
|
-
ReadableStream: ReadableStream$1, TextEncoder
|
|
3770
|
-
} = utils$1.global;
|
|
3771
|
-
|
|
3984
|
+
const { ReadableStream: ReadableStream$1, TextEncoder } = utils$1.global;
|
|
3772
3985
|
|
|
3773
3986
|
const test = (fn, ...args) => {
|
|
3774
3987
|
try {
|
|
3775
3988
|
return !!fn(...args);
|
|
3776
3989
|
} catch (e) {
|
|
3777
|
-
return false
|
|
3990
|
+
return false;
|
|
3778
3991
|
}
|
|
3779
3992
|
};
|
|
3780
3993
|
|
|
3781
3994
|
const factory = (env) => {
|
|
3782
|
-
env = utils$1.merge.call(
|
|
3783
|
-
|
|
3784
|
-
|
|
3995
|
+
env = utils$1.merge.call(
|
|
3996
|
+
{
|
|
3997
|
+
skipUndefined: true,
|
|
3998
|
+
},
|
|
3999
|
+
globalFetchAPI,
|
|
4000
|
+
env
|
|
4001
|
+
);
|
|
3785
4002
|
|
|
3786
|
-
const {fetch: envFetch, Request, Response} = env;
|
|
4003
|
+
const { fetch: envFetch, Request, Response } = env;
|
|
3787
4004
|
const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
|
|
3788
4005
|
const isRequestSupported = isFunction(Request);
|
|
3789
4006
|
const isResponseSupported = isFunction(Response);
|
|
@@ -3794,46 +4011,65 @@ const factory = (env) => {
|
|
|
3794
4011
|
|
|
3795
4012
|
const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
|
|
3796
4013
|
|
|
3797
|
-
const encodeText =
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
4014
|
+
const encodeText =
|
|
4015
|
+
isFetchSupported &&
|
|
4016
|
+
(typeof TextEncoder === 'function'
|
|
4017
|
+
? (
|
|
4018
|
+
(encoder) => (str) =>
|
|
4019
|
+
encoder.encode(str)
|
|
4020
|
+
)(new TextEncoder())
|
|
4021
|
+
: async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
|
|
3801
4022
|
|
|
3802
|
-
const supportsRequestStream =
|
|
3803
|
-
|
|
4023
|
+
const supportsRequestStream =
|
|
4024
|
+
isRequestSupported &&
|
|
4025
|
+
isReadableStreamSupported &&
|
|
4026
|
+
test(() => {
|
|
4027
|
+
let duplexAccessed = false;
|
|
3804
4028
|
|
|
3805
|
-
|
|
3806
|
-
body: new ReadableStream$1(),
|
|
3807
|
-
method: 'POST',
|
|
3808
|
-
get duplex() {
|
|
3809
|
-
duplexAccessed = true;
|
|
3810
|
-
return 'half';
|
|
3811
|
-
},
|
|
3812
|
-
}).headers.has('Content-Type');
|
|
4029
|
+
const body = new ReadableStream$1();
|
|
3813
4030
|
|
|
3814
|
-
|
|
3815
|
-
|
|
4031
|
+
const hasContentType = new Request(platform.origin, {
|
|
4032
|
+
body,
|
|
4033
|
+
method: 'POST',
|
|
4034
|
+
get duplex() {
|
|
4035
|
+
duplexAccessed = true;
|
|
4036
|
+
return 'half';
|
|
4037
|
+
},
|
|
4038
|
+
}).headers.has('Content-Type');
|
|
4039
|
+
|
|
4040
|
+
body.cancel();
|
|
4041
|
+
|
|
4042
|
+
return duplexAccessed && !hasContentType;
|
|
4043
|
+
});
|
|
3816
4044
|
|
|
3817
|
-
const supportsResponseStream =
|
|
4045
|
+
const supportsResponseStream =
|
|
4046
|
+
isResponseSupported &&
|
|
4047
|
+
isReadableStreamSupported &&
|
|
3818
4048
|
test(() => utils$1.isReadableStream(new Response('').body));
|
|
3819
4049
|
|
|
3820
4050
|
const resolvers = {
|
|
3821
|
-
stream: supportsResponseStream && ((res) => res.body)
|
|
4051
|
+
stream: supportsResponseStream && ((res) => res.body),
|
|
3822
4052
|
};
|
|
3823
4053
|
|
|
3824
|
-
isFetchSupported &&
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
4054
|
+
isFetchSupported &&
|
|
4055
|
+
(() => {
|
|
4056
|
+
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach((type) => {
|
|
4057
|
+
!resolvers[type] &&
|
|
4058
|
+
(resolvers[type] = (res, config) => {
|
|
4059
|
+
let method = res && res[type];
|
|
3828
4060
|
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
4061
|
+
if (method) {
|
|
4062
|
+
return method.call(res);
|
|
4063
|
+
}
|
|
3832
4064
|
|
|
3833
|
-
|
|
4065
|
+
throw new AxiosError(
|
|
4066
|
+
`Response type '${type}' is not supported`,
|
|
4067
|
+
AxiosError.ERR_NOT_SUPPORT,
|
|
4068
|
+
config
|
|
4069
|
+
);
|
|
4070
|
+
});
|
|
3834
4071
|
});
|
|
3835
|
-
});
|
|
3836
|
-
})());
|
|
4072
|
+
})();
|
|
3837
4073
|
|
|
3838
4074
|
const getBodyLength = async (body) => {
|
|
3839
4075
|
if (body == null) {
|
|
@@ -3884,32 +4120,41 @@ const factory = (env) => {
|
|
|
3884
4120
|
responseType,
|
|
3885
4121
|
headers,
|
|
3886
4122
|
withCredentials = 'same-origin',
|
|
3887
|
-
fetchOptions
|
|
4123
|
+
fetchOptions,
|
|
3888
4124
|
} = resolveConfig(config);
|
|
3889
4125
|
|
|
3890
4126
|
let _fetch = envFetch || fetch;
|
|
3891
4127
|
|
|
3892
4128
|
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
3893
4129
|
|
|
3894
|
-
let composedSignal = composeSignals
|
|
4130
|
+
let composedSignal = composeSignals(
|
|
4131
|
+
[signal, cancelToken && cancelToken.toAbortSignal()],
|
|
4132
|
+
timeout
|
|
4133
|
+
);
|
|
3895
4134
|
|
|
3896
4135
|
let request = null;
|
|
3897
4136
|
|
|
3898
|
-
const unsubscribe =
|
|
3899
|
-
composedSignal
|
|
3900
|
-
|
|
4137
|
+
const unsubscribe =
|
|
4138
|
+
composedSignal &&
|
|
4139
|
+
composedSignal.unsubscribe &&
|
|
4140
|
+
(() => {
|
|
4141
|
+
composedSignal.unsubscribe();
|
|
4142
|
+
});
|
|
3901
4143
|
|
|
3902
4144
|
let requestContentLength;
|
|
3903
4145
|
|
|
3904
4146
|
try {
|
|
3905
4147
|
if (
|
|
3906
|
-
onUploadProgress &&
|
|
4148
|
+
onUploadProgress &&
|
|
4149
|
+
supportsRequestStream &&
|
|
4150
|
+
method !== 'get' &&
|
|
4151
|
+
method !== 'head' &&
|
|
3907
4152
|
(requestContentLength = await resolveBodyLength(headers, data)) !== 0
|
|
3908
4153
|
) {
|
|
3909
4154
|
let _request = new Request(url, {
|
|
3910
4155
|
method: 'POST',
|
|
3911
4156
|
body: data,
|
|
3912
|
-
duplex:
|
|
4157
|
+
duplex: 'half',
|
|
3913
4158
|
});
|
|
3914
4159
|
|
|
3915
4160
|
let contentTypeHeader;
|
|
@@ -3934,7 +4179,7 @@ const factory = (env) => {
|
|
|
3934
4179
|
|
|
3935
4180
|
// Cloudflare Workers throws when credentials are defined
|
|
3936
4181
|
// see https://github.com/cloudflare/workerd/issues/902
|
|
3937
|
-
const isCredentialsSupported = isRequestSupported &&
|
|
4182
|
+
const isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype;
|
|
3938
4183
|
|
|
3939
4184
|
const resolvedOptions = {
|
|
3940
4185
|
...fetchOptions,
|
|
@@ -3942,29 +4187,35 @@ const factory = (env) => {
|
|
|
3942
4187
|
method: method.toUpperCase(),
|
|
3943
4188
|
headers: headers.normalize().toJSON(),
|
|
3944
4189
|
body: data,
|
|
3945
|
-
duplex:
|
|
3946
|
-
credentials: isCredentialsSupported ? withCredentials : undefined
|
|
4190
|
+
duplex: 'half',
|
|
4191
|
+
credentials: isCredentialsSupported ? withCredentials : undefined,
|
|
3947
4192
|
};
|
|
3948
4193
|
|
|
3949
4194
|
request = isRequestSupported && new Request(url, resolvedOptions);
|
|
3950
4195
|
|
|
3951
|
-
let response = await (isRequestSupported
|
|
4196
|
+
let response = await (isRequestSupported
|
|
4197
|
+
? _fetch(request, fetchOptions)
|
|
4198
|
+
: _fetch(url, resolvedOptions));
|
|
3952
4199
|
|
|
3953
|
-
const isStreamResponse =
|
|
4200
|
+
const isStreamResponse =
|
|
4201
|
+
supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
3954
4202
|
|
|
3955
4203
|
if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
|
|
3956
4204
|
const options = {};
|
|
3957
4205
|
|
|
3958
|
-
['status', 'statusText', 'headers'].forEach(prop => {
|
|
4206
|
+
['status', 'statusText', 'headers'].forEach((prop) => {
|
|
3959
4207
|
options[prop] = response[prop];
|
|
3960
4208
|
});
|
|
3961
4209
|
|
|
3962
4210
|
const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
|
|
3963
4211
|
|
|
3964
|
-
const [onProgress, flush] =
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
4212
|
+
const [onProgress, flush] =
|
|
4213
|
+
(onDownloadProgress &&
|
|
4214
|
+
progressEventDecorator(
|
|
4215
|
+
responseContentLength,
|
|
4216
|
+
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
4217
|
+
)) ||
|
|
4218
|
+
[];
|
|
3968
4219
|
|
|
3969
4220
|
response = new Response(
|
|
3970
4221
|
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
@@ -3977,54 +4228,64 @@ const factory = (env) => {
|
|
|
3977
4228
|
|
|
3978
4229
|
responseType = responseType || 'text';
|
|
3979
4230
|
|
|
3980
|
-
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](
|
|
4231
|
+
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](
|
|
4232
|
+
response,
|
|
4233
|
+
config
|
|
4234
|
+
);
|
|
3981
4235
|
|
|
3982
4236
|
!isStreamResponse && unsubscribe && unsubscribe();
|
|
3983
4237
|
|
|
3984
4238
|
return await new Promise((resolve, reject) => {
|
|
3985
4239
|
settle(resolve, reject, {
|
|
3986
4240
|
data: responseData,
|
|
3987
|
-
headers: AxiosHeaders
|
|
4241
|
+
headers: AxiosHeaders.from(response.headers),
|
|
3988
4242
|
status: response.status,
|
|
3989
4243
|
statusText: response.statusText,
|
|
3990
4244
|
config,
|
|
3991
|
-
request
|
|
4245
|
+
request,
|
|
3992
4246
|
});
|
|
3993
|
-
})
|
|
4247
|
+
});
|
|
3994
4248
|
} catch (err) {
|
|
3995
4249
|
unsubscribe && unsubscribe();
|
|
3996
4250
|
|
|
3997
4251
|
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
|
3998
4252
|
throw Object.assign(
|
|
3999
|
-
new AxiosError
|
|
4253
|
+
new AxiosError(
|
|
4254
|
+
'Network Error',
|
|
4255
|
+
AxiosError.ERR_NETWORK,
|
|
4256
|
+
config,
|
|
4257
|
+
request,
|
|
4258
|
+
err && err.response
|
|
4259
|
+
),
|
|
4000
4260
|
{
|
|
4001
|
-
cause: err.cause || err
|
|
4261
|
+
cause: err.cause || err,
|
|
4002
4262
|
}
|
|
4003
|
-
)
|
|
4263
|
+
);
|
|
4004
4264
|
}
|
|
4005
4265
|
|
|
4006
|
-
throw AxiosError
|
|
4266
|
+
throw AxiosError.from(err, err && err.code, config, request, err && err.response);
|
|
4007
4267
|
}
|
|
4008
|
-
}
|
|
4268
|
+
};
|
|
4009
4269
|
};
|
|
4010
4270
|
|
|
4011
4271
|
const seedCache = new Map();
|
|
4012
4272
|
|
|
4013
4273
|
const getFetch = (config) => {
|
|
4014
4274
|
let env = (config && config.env) || {};
|
|
4015
|
-
const {fetch, Request, Response} = env;
|
|
4016
|
-
const seeds = [
|
|
4017
|
-
Request, Response, fetch
|
|
4018
|
-
];
|
|
4275
|
+
const { fetch, Request, Response } = env;
|
|
4276
|
+
const seeds = [Request, Response, fetch];
|
|
4019
4277
|
|
|
4020
|
-
let len = seeds.length,
|
|
4021
|
-
|
|
4278
|
+
let len = seeds.length,
|
|
4279
|
+
i = len,
|
|
4280
|
+
seed,
|
|
4281
|
+
target,
|
|
4282
|
+
map = seedCache;
|
|
4022
4283
|
|
|
4023
4284
|
while (i--) {
|
|
4024
4285
|
seed = seeds[i];
|
|
4025
4286
|
target = map.get(seed);
|
|
4026
4287
|
|
|
4027
|
-
target === undefined && map.set(seed, target =
|
|
4288
|
+
target === undefined && map.set(seed, (target = i ? new Map() : factory(env)));
|
|
4028
4289
|
|
|
4029
4290
|
map = target;
|
|
4030
4291
|
}
|
|
@@ -4040,7 +4301,7 @@ getFetch();
|
|
|
4040
4301
|
* - `http` for Node.js
|
|
4041
4302
|
* - `xhr` for browsers
|
|
4042
4303
|
* - `fetch` for fetch API-based requests
|
|
4043
|
-
*
|
|
4304
|
+
*
|
|
4044
4305
|
* @type {Object<string, Function|Object>}
|
|
4045
4306
|
*/
|
|
4046
4307
|
const knownAdapters = {
|
|
@@ -4048,7 +4309,7 @@ const knownAdapters = {
|
|
|
4048
4309
|
xhr: xhrAdapter,
|
|
4049
4310
|
fetch: {
|
|
4050
4311
|
get: getFetch,
|
|
4051
|
-
}
|
|
4312
|
+
},
|
|
4052
4313
|
};
|
|
4053
4314
|
|
|
4054
4315
|
// Assign adapter names for easier debugging and identification
|
|
@@ -4065,7 +4326,7 @@ utils$1.forEach(knownAdapters, (fn, value) => {
|
|
|
4065
4326
|
|
|
4066
4327
|
/**
|
|
4067
4328
|
* Render a rejection reason string for unknown or unsupported adapters
|
|
4068
|
-
*
|
|
4329
|
+
*
|
|
4069
4330
|
* @param {string} reason
|
|
4070
4331
|
* @returns {string}
|
|
4071
4332
|
*/
|
|
@@ -4073,17 +4334,18 @@ const renderReason = (reason) => `- ${reason}`;
|
|
|
4073
4334
|
|
|
4074
4335
|
/**
|
|
4075
4336
|
* Check if the adapter is resolved (function, null, or false)
|
|
4076
|
-
*
|
|
4337
|
+
*
|
|
4077
4338
|
* @param {Function|null|false} adapter
|
|
4078
4339
|
* @returns {boolean}
|
|
4079
4340
|
*/
|
|
4080
|
-
const isResolvedHandle = (adapter) =>
|
|
4341
|
+
const isResolvedHandle = (adapter) =>
|
|
4342
|
+
utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
4081
4343
|
|
|
4082
4344
|
/**
|
|
4083
4345
|
* Get the first suitable adapter from the provided list.
|
|
4084
4346
|
* Tries each adapter in order until a supported one is found.
|
|
4085
4347
|
* Throws an AxiosError if no adapter is suitable.
|
|
4086
|
-
*
|
|
4348
|
+
*
|
|
4087
4349
|
* @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
|
|
4088
4350
|
* @param {Object} config - Axios request configuration
|
|
4089
4351
|
* @throws {AxiosError} If no suitable adapter is available
|
|
@@ -4108,7 +4370,7 @@ function getAdapter(adapters, config) {
|
|
|
4108
4370
|
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
4109
4371
|
|
|
4110
4372
|
if (adapter === undefined) {
|
|
4111
|
-
throw new AxiosError
|
|
4373
|
+
throw new AxiosError(`Unknown adapter '${id}'`);
|
|
4112
4374
|
}
|
|
4113
4375
|
}
|
|
4114
4376
|
|
|
@@ -4120,16 +4382,19 @@ function getAdapter(adapters, config) {
|
|
|
4120
4382
|
}
|
|
4121
4383
|
|
|
4122
4384
|
if (!adapter) {
|
|
4123
|
-
const reasons = Object.entries(rejectedReasons)
|
|
4124
|
-
|
|
4385
|
+
const reasons = Object.entries(rejectedReasons).map(
|
|
4386
|
+
([id, state]) =>
|
|
4387
|
+
`adapter ${id} ` +
|
|
4125
4388
|
(state === false ? 'is not supported by the environment' : 'is not available in the build')
|
|
4126
|
-
|
|
4389
|
+
);
|
|
4127
4390
|
|
|
4128
|
-
let s = length
|
|
4129
|
-
|
|
4130
|
-
|
|
4391
|
+
let s = length
|
|
4392
|
+
? reasons.length > 1
|
|
4393
|
+
? 'since :\n' + reasons.map(renderReason).join('\n')
|
|
4394
|
+
: ' ' + renderReason(reasons[0])
|
|
4395
|
+
: 'as no adapter specified';
|
|
4131
4396
|
|
|
4132
|
-
throw new AxiosError
|
|
4397
|
+
throw new AxiosError(
|
|
4133
4398
|
`There is no suitable adapter to dispatch the request ` + s,
|
|
4134
4399
|
'ERR_NOT_SUPPORT'
|
|
4135
4400
|
);
|
|
@@ -4152,7 +4417,7 @@ var adapters = {
|
|
|
4152
4417
|
* Exposes all known adapters
|
|
4153
4418
|
* @type {Object<string, Function|Object>}
|
|
4154
4419
|
*/
|
|
4155
|
-
adapters: knownAdapters
|
|
4420
|
+
adapters: knownAdapters,
|
|
4156
4421
|
};
|
|
4157
4422
|
|
|
4158
4423
|
/**
|
|
@@ -4168,7 +4433,7 @@ function throwIfCancellationRequested(config) {
|
|
|
4168
4433
|
}
|
|
4169
4434
|
|
|
4170
4435
|
if (config.signal && config.signal.aborted) {
|
|
4171
|
-
throw new CanceledError
|
|
4436
|
+
throw new CanceledError(null, config);
|
|
4172
4437
|
}
|
|
4173
4438
|
}
|
|
4174
4439
|
|
|
@@ -4182,53 +4447,49 @@ function throwIfCancellationRequested(config) {
|
|
|
4182
4447
|
function dispatchRequest(config) {
|
|
4183
4448
|
throwIfCancellationRequested(config);
|
|
4184
4449
|
|
|
4185
|
-
config.headers = AxiosHeaders
|
|
4450
|
+
config.headers = AxiosHeaders.from(config.headers);
|
|
4186
4451
|
|
|
4187
4452
|
// Transform request data
|
|
4188
|
-
config.data = transformData.call(
|
|
4189
|
-
config,
|
|
4190
|
-
config.transformRequest
|
|
4191
|
-
);
|
|
4453
|
+
config.data = transformData.call(config, config.transformRequest);
|
|
4192
4454
|
|
|
4193
4455
|
if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
|
|
4194
4456
|
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
|
4195
4457
|
}
|
|
4196
4458
|
|
|
4197
|
-
const adapter = adapters.getAdapter(config.adapter || defaults
|
|
4198
|
-
|
|
4199
|
-
return adapter(config).then(function onAdapterResolution(response) {
|
|
4200
|
-
throwIfCancellationRequested(config);
|
|
4201
|
-
|
|
4202
|
-
// Transform response data
|
|
4203
|
-
response.data = transformData.call(
|
|
4204
|
-
config,
|
|
4205
|
-
config.transformResponse,
|
|
4206
|
-
response
|
|
4207
|
-
);
|
|
4208
|
-
|
|
4209
|
-
response.headers = AxiosHeaders$1.from(response.headers);
|
|
4459
|
+
const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
|
|
4210
4460
|
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
if (!isCancel(reason)) {
|
|
4461
|
+
return adapter(config).then(
|
|
4462
|
+
function onAdapterResolution(response) {
|
|
4214
4463
|
throwIfCancellationRequested(config);
|
|
4215
4464
|
|
|
4216
4465
|
// Transform response data
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4466
|
+
response.data = transformData.call(config, config.transformResponse, response);
|
|
4467
|
+
|
|
4468
|
+
response.headers = AxiosHeaders.from(response.headers);
|
|
4469
|
+
|
|
4470
|
+
return response;
|
|
4471
|
+
},
|
|
4472
|
+
function onAdapterRejection(reason) {
|
|
4473
|
+
if (!isCancel(reason)) {
|
|
4474
|
+
throwIfCancellationRequested(config);
|
|
4475
|
+
|
|
4476
|
+
// Transform response data
|
|
4477
|
+
if (reason && reason.response) {
|
|
4478
|
+
reason.response.data = transformData.call(
|
|
4479
|
+
config,
|
|
4480
|
+
config.transformResponse,
|
|
4481
|
+
reason.response
|
|
4482
|
+
);
|
|
4483
|
+
reason.response.headers = AxiosHeaders.from(reason.response.headers);
|
|
4484
|
+
}
|
|
4224
4485
|
}
|
|
4225
|
-
}
|
|
4226
4486
|
|
|
4227
|
-
|
|
4228
|
-
|
|
4487
|
+
return Promise.reject(reason);
|
|
4488
|
+
}
|
|
4489
|
+
);
|
|
4229
4490
|
}
|
|
4230
4491
|
|
|
4231
|
-
const VERSION = "1.
|
|
4492
|
+
const VERSION = "1.15.0";
|
|
4232
4493
|
|
|
4233
4494
|
const validators$1 = {};
|
|
4234
4495
|
|
|
@@ -4252,15 +4513,23 @@ const deprecatedWarnings = {};
|
|
|
4252
4513
|
*/
|
|
4253
4514
|
validators$1.transitional = function transitional(validator, version, message) {
|
|
4254
4515
|
function formatMessage(opt, desc) {
|
|
4255
|
-
return
|
|
4516
|
+
return (
|
|
4517
|
+
'[Axios v' +
|
|
4518
|
+
VERSION +
|
|
4519
|
+
"] Transitional option '" +
|
|
4520
|
+
opt +
|
|
4521
|
+
"'" +
|
|
4522
|
+
desc +
|
|
4523
|
+
(message ? '. ' + message : '')
|
|
4524
|
+
);
|
|
4256
4525
|
}
|
|
4257
4526
|
|
|
4258
4527
|
// eslint-disable-next-line func-names
|
|
4259
4528
|
return (value, opt, opts) => {
|
|
4260
4529
|
if (validator === false) {
|
|
4261
|
-
throw new AxiosError
|
|
4530
|
+
throw new AxiosError(
|
|
4262
4531
|
formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
|
|
4263
|
-
AxiosError
|
|
4532
|
+
AxiosError.ERR_DEPRECATED
|
|
4264
4533
|
);
|
|
4265
4534
|
}
|
|
4266
4535
|
|
|
@@ -4284,7 +4553,7 @@ validators$1.spelling = function spelling(correctSpelling) {
|
|
|
4284
4553
|
// eslint-disable-next-line no-console
|
|
4285
4554
|
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
|
|
4286
4555
|
return true;
|
|
4287
|
-
}
|
|
4556
|
+
};
|
|
4288
4557
|
};
|
|
4289
4558
|
|
|
4290
4559
|
/**
|
|
@@ -4299,7 +4568,7 @@ validators$1.spelling = function spelling(correctSpelling) {
|
|
|
4299
4568
|
|
|
4300
4569
|
function assertOptions(options, schema, allowUnknown) {
|
|
4301
4570
|
if (typeof options !== 'object') {
|
|
4302
|
-
throw new AxiosError
|
|
4571
|
+
throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
|
|
4303
4572
|
}
|
|
4304
4573
|
const keys = Object.keys(options);
|
|
4305
4574
|
let i = keys.length;
|
|
@@ -4310,19 +4579,22 @@ function assertOptions(options, schema, allowUnknown) {
|
|
|
4310
4579
|
const value = options[opt];
|
|
4311
4580
|
const result = value === undefined || validator(value, opt, options);
|
|
4312
4581
|
if (result !== true) {
|
|
4313
|
-
throw new AxiosError
|
|
4582
|
+
throw new AxiosError(
|
|
4583
|
+
'option ' + opt + ' must be ' + result,
|
|
4584
|
+
AxiosError.ERR_BAD_OPTION_VALUE
|
|
4585
|
+
);
|
|
4314
4586
|
}
|
|
4315
4587
|
continue;
|
|
4316
4588
|
}
|
|
4317
4589
|
if (allowUnknown !== true) {
|
|
4318
|
-
throw new AxiosError
|
|
4590
|
+
throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
|
|
4319
4591
|
}
|
|
4320
4592
|
}
|
|
4321
4593
|
}
|
|
4322
4594
|
|
|
4323
4595
|
var validator = {
|
|
4324
4596
|
assertOptions,
|
|
4325
|
-
validators: validators$1
|
|
4597
|
+
validators: validators$1,
|
|
4326
4598
|
};
|
|
4327
4599
|
|
|
4328
4600
|
const validators = validator.validators;
|
|
@@ -4338,8 +4610,8 @@ class Axios {
|
|
|
4338
4610
|
constructor(instanceConfig) {
|
|
4339
4611
|
this.defaults = instanceConfig || {};
|
|
4340
4612
|
this.interceptors = {
|
|
4341
|
-
request: new InterceptorManager
|
|
4342
|
-
response: new InterceptorManager
|
|
4613
|
+
request: new InterceptorManager(),
|
|
4614
|
+
response: new InterceptorManager(),
|
|
4343
4615
|
};
|
|
4344
4616
|
}
|
|
4345
4617
|
|
|
@@ -4361,13 +4633,29 @@ class Axios {
|
|
|
4361
4633
|
Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
|
|
4362
4634
|
|
|
4363
4635
|
// slice off the Error: ... line
|
|
4364
|
-
const stack =
|
|
4636
|
+
const stack = (() => {
|
|
4637
|
+
if (!dummy.stack) {
|
|
4638
|
+
return '';
|
|
4639
|
+
}
|
|
4640
|
+
|
|
4641
|
+
const firstNewlineIndex = dummy.stack.indexOf('\n');
|
|
4642
|
+
|
|
4643
|
+
return firstNewlineIndex === -1 ? '' : dummy.stack.slice(firstNewlineIndex + 1);
|
|
4644
|
+
})();
|
|
4365
4645
|
try {
|
|
4366
4646
|
if (!err.stack) {
|
|
4367
4647
|
err.stack = stack;
|
|
4368
4648
|
// match without the 2 top stack lines
|
|
4369
|
-
} else if (stack
|
|
4370
|
-
|
|
4649
|
+
} else if (stack) {
|
|
4650
|
+
const firstNewlineIndex = stack.indexOf('\n');
|
|
4651
|
+
const secondNewlineIndex =
|
|
4652
|
+
firstNewlineIndex === -1 ? -1 : stack.indexOf('\n', firstNewlineIndex + 1);
|
|
4653
|
+
const stackWithoutTwoTopLines =
|
|
4654
|
+
secondNewlineIndex === -1 ? '' : stack.slice(secondNewlineIndex + 1);
|
|
4655
|
+
|
|
4656
|
+
if (!String(err.stack).endsWith(stackWithoutTwoTopLines)) {
|
|
4657
|
+
err.stack += '\n' + stack;
|
|
4658
|
+
}
|
|
4371
4659
|
}
|
|
4372
4660
|
} catch (e) {
|
|
4373
4661
|
// ignore the case where "stack" is an un-writable property
|
|
@@ -4390,27 +4678,35 @@ class Axios {
|
|
|
4390
4678
|
|
|
4391
4679
|
config = mergeConfig(this.defaults, config);
|
|
4392
4680
|
|
|
4393
|
-
const {transitional, paramsSerializer, headers} = config;
|
|
4681
|
+
const { transitional, paramsSerializer, headers } = config;
|
|
4394
4682
|
|
|
4395
4683
|
if (transitional !== undefined) {
|
|
4396
|
-
validator.assertOptions(
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4684
|
+
validator.assertOptions(
|
|
4685
|
+
transitional,
|
|
4686
|
+
{
|
|
4687
|
+
silentJSONParsing: validators.transitional(validators.boolean),
|
|
4688
|
+
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
4689
|
+
clarifyTimeoutError: validators.transitional(validators.boolean),
|
|
4690
|
+
legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
|
|
4691
|
+
},
|
|
4692
|
+
false
|
|
4693
|
+
);
|
|
4402
4694
|
}
|
|
4403
4695
|
|
|
4404
4696
|
if (paramsSerializer != null) {
|
|
4405
4697
|
if (utils$1.isFunction(paramsSerializer)) {
|
|
4406
4698
|
config.paramsSerializer = {
|
|
4407
|
-
serialize: paramsSerializer
|
|
4699
|
+
serialize: paramsSerializer,
|
|
4408
4700
|
};
|
|
4409
4701
|
} else {
|
|
4410
|
-
validator.assertOptions(
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4702
|
+
validator.assertOptions(
|
|
4703
|
+
paramsSerializer,
|
|
4704
|
+
{
|
|
4705
|
+
encode: validators.function,
|
|
4706
|
+
serialize: validators.function,
|
|
4707
|
+
},
|
|
4708
|
+
true
|
|
4709
|
+
);
|
|
4414
4710
|
}
|
|
4415
4711
|
}
|
|
4416
4712
|
|
|
@@ -4421,28 +4717,27 @@ class Axios {
|
|
|
4421
4717
|
config.allowAbsoluteUrls = true;
|
|
4422
4718
|
}
|
|
4423
4719
|
|
|
4424
|
-
validator.assertOptions(
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4720
|
+
validator.assertOptions(
|
|
4721
|
+
config,
|
|
4722
|
+
{
|
|
4723
|
+
baseUrl: validators.spelling('baseURL'),
|
|
4724
|
+
withXsrfToken: validators.spelling('withXSRFToken'),
|
|
4725
|
+
},
|
|
4726
|
+
true
|
|
4727
|
+
);
|
|
4428
4728
|
|
|
4429
4729
|
// Set config.method
|
|
4430
4730
|
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
|
4431
4731
|
|
|
4432
4732
|
// Flatten headers
|
|
4433
|
-
let contextHeaders = headers && utils$1.merge(
|
|
4434
|
-
headers.common,
|
|
4435
|
-
headers[config.method]
|
|
4436
|
-
);
|
|
4733
|
+
let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
|
|
4437
4734
|
|
|
4438
|
-
headers &&
|
|
4439
|
-
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
|
4440
|
-
(method) => {
|
|
4735
|
+
headers &&
|
|
4736
|
+
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], (method) => {
|
|
4441
4737
|
delete headers[method];
|
|
4442
|
-
}
|
|
4443
|
-
);
|
|
4738
|
+
});
|
|
4444
4739
|
|
|
4445
|
-
config.headers = AxiosHeaders
|
|
4740
|
+
config.headers = AxiosHeaders.concat(contextHeaders, headers);
|
|
4446
4741
|
|
|
4447
4742
|
// filter out skipped interceptors
|
|
4448
4743
|
const requestInterceptorChain = [];
|
|
@@ -4455,7 +4750,8 @@ class Axios {
|
|
|
4455
4750
|
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
4456
4751
|
|
|
4457
4752
|
const transitional = config.transitional || transitionalDefaults;
|
|
4458
|
-
const legacyInterceptorReqResOrdering =
|
|
4753
|
+
const legacyInterceptorReqResOrdering =
|
|
4754
|
+
transitional && transitional.legacyInterceptorReqResOrdering;
|
|
4459
4755
|
|
|
4460
4756
|
if (legacyInterceptorReqResOrdering) {
|
|
4461
4757
|
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
@@ -4529,28 +4825,32 @@ class Axios {
|
|
|
4529
4825
|
// Provide aliases for supported request methods
|
|
4530
4826
|
utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
|
4531
4827
|
/*eslint func-names:0*/
|
|
4532
|
-
Axios.prototype[method] = function(url, config) {
|
|
4533
|
-
return this.request(
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4828
|
+
Axios.prototype[method] = function (url, config) {
|
|
4829
|
+
return this.request(
|
|
4830
|
+
mergeConfig(config || {}, {
|
|
4831
|
+
method,
|
|
4832
|
+
url,
|
|
4833
|
+
data: (config || {}).data,
|
|
4834
|
+
})
|
|
4835
|
+
);
|
|
4538
4836
|
};
|
|
4539
4837
|
});
|
|
4540
4838
|
|
|
4541
4839
|
utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
4542
|
-
/*eslint func-names:0*/
|
|
4543
|
-
|
|
4544
4840
|
function generateHTTPMethod(isForm) {
|
|
4545
4841
|
return function httpMethod(url, data, config) {
|
|
4546
|
-
return this.request(
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4842
|
+
return this.request(
|
|
4843
|
+
mergeConfig(config || {}, {
|
|
4844
|
+
method,
|
|
4845
|
+
headers: isForm
|
|
4846
|
+
? {
|
|
4847
|
+
'Content-Type': 'multipart/form-data',
|
|
4848
|
+
}
|
|
4849
|
+
: {},
|
|
4850
|
+
url,
|
|
4851
|
+
data,
|
|
4852
|
+
})
|
|
4853
|
+
);
|
|
4554
4854
|
};
|
|
4555
4855
|
}
|
|
4556
4856
|
|
|
@@ -4559,8 +4859,6 @@ utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method)
|
|
|
4559
4859
|
Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
|
|
4560
4860
|
});
|
|
4561
4861
|
|
|
4562
|
-
var Axios$1 = Axios;
|
|
4563
|
-
|
|
4564
4862
|
/**
|
|
4565
4863
|
* A `CancelToken` is an object that can be used to request cancellation of an operation.
|
|
4566
4864
|
*
|
|
@@ -4583,7 +4881,7 @@ class CancelToken {
|
|
|
4583
4881
|
const token = this;
|
|
4584
4882
|
|
|
4585
4883
|
// eslint-disable-next-line func-names
|
|
4586
|
-
this.promise.then(cancel => {
|
|
4884
|
+
this.promise.then((cancel) => {
|
|
4587
4885
|
if (!token._listeners) return;
|
|
4588
4886
|
|
|
4589
4887
|
let i = token._listeners.length;
|
|
@@ -4595,10 +4893,10 @@ class CancelToken {
|
|
|
4595
4893
|
});
|
|
4596
4894
|
|
|
4597
4895
|
// eslint-disable-next-line func-names
|
|
4598
|
-
this.promise.then = onfulfilled => {
|
|
4896
|
+
this.promise.then = (onfulfilled) => {
|
|
4599
4897
|
let _resolve;
|
|
4600
4898
|
// eslint-disable-next-line func-names
|
|
4601
|
-
const promise = new Promise(resolve => {
|
|
4899
|
+
const promise = new Promise((resolve) => {
|
|
4602
4900
|
token.subscribe(resolve);
|
|
4603
4901
|
_resolve = resolve;
|
|
4604
4902
|
}).then(onfulfilled);
|
|
@@ -4616,7 +4914,7 @@ class CancelToken {
|
|
|
4616
4914
|
return;
|
|
4617
4915
|
}
|
|
4618
4916
|
|
|
4619
|
-
token.reason = new CanceledError
|
|
4917
|
+
token.reason = new CanceledError(message, config, request);
|
|
4620
4918
|
resolvePromise(token.reason);
|
|
4621
4919
|
});
|
|
4622
4920
|
}
|
|
@@ -4686,13 +4984,11 @@ class CancelToken {
|
|
|
4686
4984
|
});
|
|
4687
4985
|
return {
|
|
4688
4986
|
token,
|
|
4689
|
-
cancel
|
|
4987
|
+
cancel,
|
|
4690
4988
|
};
|
|
4691
4989
|
}
|
|
4692
4990
|
}
|
|
4693
4991
|
|
|
4694
|
-
var CancelToken$1 = CancelToken;
|
|
4695
|
-
|
|
4696
4992
|
/**
|
|
4697
4993
|
* Syntactic sugar for invoking a function and expanding an array for arguments.
|
|
4698
4994
|
*
|
|
@@ -4728,7 +5024,7 @@ function spread(callback) {
|
|
|
4728
5024
|
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
|
4729
5025
|
*/
|
|
4730
5026
|
function isAxiosError(payload) {
|
|
4731
|
-
return utils$1.isObject(payload) &&
|
|
5027
|
+
return utils$1.isObject(payload) && payload.isAxiosError === true;
|
|
4732
5028
|
}
|
|
4733
5029
|
|
|
4734
5030
|
const HttpStatusCode = {
|
|
@@ -4807,8 +5103,6 @@ Object.entries(HttpStatusCode).forEach(([key, value]) => {
|
|
|
4807
5103
|
HttpStatusCode[value] = key;
|
|
4808
5104
|
});
|
|
4809
5105
|
|
|
4810
|
-
var HttpStatusCode$1 = HttpStatusCode;
|
|
4811
|
-
|
|
4812
5106
|
/**
|
|
4813
5107
|
* Create an instance of Axios
|
|
4814
5108
|
*
|
|
@@ -4817,14 +5111,14 @@ var HttpStatusCode$1 = HttpStatusCode;
|
|
|
4817
5111
|
* @returns {Axios} A new instance of Axios
|
|
4818
5112
|
*/
|
|
4819
5113
|
function createInstance(defaultConfig) {
|
|
4820
|
-
const context = new Axios
|
|
4821
|
-
const instance = bind(Axios
|
|
5114
|
+
const context = new Axios(defaultConfig);
|
|
5115
|
+
const instance = bind(Axios.prototype.request, context);
|
|
4822
5116
|
|
|
4823
5117
|
// Copy axios.prototype to instance
|
|
4824
|
-
utils$1.extend(instance, Axios
|
|
5118
|
+
utils$1.extend(instance, Axios.prototype, context, { allOwnKeys: true });
|
|
4825
5119
|
|
|
4826
5120
|
// Copy context to instance
|
|
4827
|
-
utils$1.extend(instance, context, null, {allOwnKeys: true});
|
|
5121
|
+
utils$1.extend(instance, context, null, { allOwnKeys: true });
|
|
4828
5122
|
|
|
4829
5123
|
// Factory for creating new instances
|
|
4830
5124
|
instance.create = function create(instanceConfig) {
|
|
@@ -4835,20 +5129,20 @@ function createInstance(defaultConfig) {
|
|
|
4835
5129
|
}
|
|
4836
5130
|
|
|
4837
5131
|
// Create the default instance to be exported
|
|
4838
|
-
const axios = createInstance(defaults
|
|
5132
|
+
const axios = createInstance(defaults);
|
|
4839
5133
|
|
|
4840
5134
|
// Expose Axios class to allow class inheritance
|
|
4841
|
-
axios.Axios = Axios
|
|
5135
|
+
axios.Axios = Axios;
|
|
4842
5136
|
|
|
4843
5137
|
// Expose Cancel & CancelToken
|
|
4844
|
-
axios.CanceledError = CanceledError
|
|
4845
|
-
axios.CancelToken = CancelToken
|
|
5138
|
+
axios.CanceledError = CanceledError;
|
|
5139
|
+
axios.CancelToken = CancelToken;
|
|
4846
5140
|
axios.isCancel = isCancel;
|
|
4847
5141
|
axios.VERSION = VERSION;
|
|
4848
5142
|
axios.toFormData = toFormData;
|
|
4849
5143
|
|
|
4850
5144
|
// Expose AxiosError class
|
|
4851
|
-
axios.AxiosError = AxiosError
|
|
5145
|
+
axios.AxiosError = AxiosError;
|
|
4852
5146
|
|
|
4853
5147
|
// alias for CanceledError for backward compatibility
|
|
4854
5148
|
axios.Cancel = axios.CanceledError;
|
|
@@ -4866,13 +5160,13 @@ axios.isAxiosError = isAxiosError;
|
|
|
4866
5160
|
// Expose mergeConfig
|
|
4867
5161
|
axios.mergeConfig = mergeConfig;
|
|
4868
5162
|
|
|
4869
|
-
axios.AxiosHeaders = AxiosHeaders
|
|
5163
|
+
axios.AxiosHeaders = AxiosHeaders;
|
|
4870
5164
|
|
|
4871
|
-
axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
5165
|
+
axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
4872
5166
|
|
|
4873
5167
|
axios.getAdapter = adapters.getAdapter;
|
|
4874
5168
|
|
|
4875
|
-
axios.HttpStatusCode = HttpStatusCode
|
|
5169
|
+
axios.HttpStatusCode = HttpStatusCode;
|
|
4876
5170
|
|
|
4877
5171
|
axios.default = axios;
|
|
4878
5172
|
|
|
@@ -4880,7 +5174,7 @@ module.exports = axios;
|
|
|
4880
5174
|
//# sourceMappingURL=axios.cjs.map
|
|
4881
5175
|
|
|
4882
5176
|
|
|
4883
|
-
/***/ }
|
|
5177
|
+
/***/ }
|
|
4884
5178
|
|
|
4885
5179
|
/******/ });
|
|
4886
5180
|
/************************************************************************/
|
|
@@ -4902,6 +5196,12 @@ module.exports = axios;
|
|
|
4902
5196
|
/******/ };
|
|
4903
5197
|
/******/
|
|
4904
5198
|
/******/ // Execute the module function
|
|
5199
|
+
/******/ if (!(moduleId in __webpack_modules__)) {
|
|
5200
|
+
/******/ delete __webpack_module_cache__[moduleId];
|
|
5201
|
+
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
|
|
5202
|
+
/******/ e.code = 'MODULE_NOT_FOUND';
|
|
5203
|
+
/******/ throw e;
|
|
5204
|
+
/******/ }
|
|
4905
5205
|
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
4906
5206
|
/******/
|
|
4907
5207
|
/******/ // Return the exports of the module
|