@kontent-ai/core-sdk 10.12.1 → 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 +1261 -891
- 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 +446 -446
- package/dist/umd/stats.min.json +440 -440
- package/lib/sdk-info.generated.ts +1 -1
- package/package.json +19 -20
|
@@ -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
|
/**
|
|
@@ -917,30 +917,30 @@ function bind(fn, thisArg) {
|
|
|
917
917
|
|
|
918
918
|
// utils is a library of generic helper functions non-specific to axios
|
|
919
919
|
|
|
920
|
-
const {toString} = Object.prototype;
|
|
921
|
-
const {getPrototypeOf} = Object;
|
|
922
|
-
const {iterator, toStringTag} = Symbol;
|
|
920
|
+
const { toString } = Object.prototype;
|
|
921
|
+
const { getPrototypeOf } = Object;
|
|
922
|
+
const { iterator, toStringTag } = Symbol;
|
|
923
923
|
|
|
924
|
-
const kindOf = (cache => thing => {
|
|
925
|
-
|
|
926
|
-
|
|
924
|
+
const kindOf = ((cache) => (thing) => {
|
|
925
|
+
const str = toString.call(thing);
|
|
926
|
+
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
|
927
927
|
})(Object.create(null));
|
|
928
928
|
|
|
929
929
|
const kindOfTest = (type) => {
|
|
930
930
|
type = type.toLowerCase();
|
|
931
|
-
return (thing) => kindOf(thing) === type
|
|
931
|
+
return (thing) => kindOf(thing) === type;
|
|
932
932
|
};
|
|
933
933
|
|
|
934
|
-
const typeOfTest = type => thing => typeof thing === type;
|
|
934
|
+
const typeOfTest = (type) => (thing) => typeof thing === type;
|
|
935
935
|
|
|
936
936
|
/**
|
|
937
|
-
* Determine if a value is
|
|
937
|
+
* Determine if a value is a non-null object
|
|
938
938
|
*
|
|
939
939
|
* @param {Object} val The value to test
|
|
940
940
|
*
|
|
941
941
|
* @returns {boolean} True if value is an Array, otherwise false
|
|
942
942
|
*/
|
|
943
|
-
const {isArray} = Array;
|
|
943
|
+
const { isArray } = Array;
|
|
944
944
|
|
|
945
945
|
/**
|
|
946
946
|
* Determine if a value is undefined
|
|
@@ -959,8 +959,14 @@ const isUndefined = typeOfTest('undefined');
|
|
|
959
959
|
* @returns {boolean} True if value is a Buffer, otherwise false
|
|
960
960
|
*/
|
|
961
961
|
function isBuffer(val) {
|
|
962
|
-
return
|
|
963
|
-
|
|
962
|
+
return (
|
|
963
|
+
val !== null &&
|
|
964
|
+
!isUndefined(val) &&
|
|
965
|
+
val.constructor !== null &&
|
|
966
|
+
!isUndefined(val.constructor) &&
|
|
967
|
+
isFunction$1(val.constructor.isBuffer) &&
|
|
968
|
+
val.constructor.isBuffer(val)
|
|
969
|
+
);
|
|
964
970
|
}
|
|
965
971
|
|
|
966
972
|
/**
|
|
@@ -972,7 +978,6 @@ function isBuffer(val) {
|
|
|
972
978
|
*/
|
|
973
979
|
const isArrayBuffer = kindOfTest('ArrayBuffer');
|
|
974
980
|
|
|
975
|
-
|
|
976
981
|
/**
|
|
977
982
|
* Determine if a value is a view on an ArrayBuffer
|
|
978
983
|
*
|
|
@@ -982,10 +987,10 @@ const isArrayBuffer = kindOfTest('ArrayBuffer');
|
|
|
982
987
|
*/
|
|
983
988
|
function isArrayBufferView(val) {
|
|
984
989
|
let result;
|
|
985
|
-
if (
|
|
990
|
+
if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
|
|
986
991
|
result = ArrayBuffer.isView(val);
|
|
987
992
|
} else {
|
|
988
|
-
result =
|
|
993
|
+
result = val && val.buffer && isArrayBuffer(val.buffer);
|
|
989
994
|
}
|
|
990
995
|
return result;
|
|
991
996
|
}
|
|
@@ -1031,7 +1036,7 @@ const isObject = (thing) => thing !== null && typeof thing === 'object';
|
|
|
1031
1036
|
* @param {*} thing The value to test
|
|
1032
1037
|
* @returns {boolean} True if value is a Boolean, otherwise false
|
|
1033
1038
|
*/
|
|
1034
|
-
const isBoolean = thing => thing === true || thing === false;
|
|
1039
|
+
const isBoolean = (thing) => thing === true || thing === false;
|
|
1035
1040
|
|
|
1036
1041
|
/**
|
|
1037
1042
|
* Determine if a value is a plain Object
|
|
@@ -1046,7 +1051,13 @@ const isPlainObject = (val) => {
|
|
|
1046
1051
|
}
|
|
1047
1052
|
|
|
1048
1053
|
const prototype = getPrototypeOf(val);
|
|
1049
|
-
return (
|
|
1054
|
+
return (
|
|
1055
|
+
(prototype === null ||
|
|
1056
|
+
prototype === Object.prototype ||
|
|
1057
|
+
Object.getPrototypeOf(prototype) === null) &&
|
|
1058
|
+
!(toStringTag in val) &&
|
|
1059
|
+
!(iterator in val)
|
|
1060
|
+
);
|
|
1050
1061
|
};
|
|
1051
1062
|
|
|
1052
1063
|
/**
|
|
@@ -1088,6 +1099,31 @@ const isDate = kindOfTest('Date');
|
|
|
1088
1099
|
*/
|
|
1089
1100
|
const isFile = kindOfTest('File');
|
|
1090
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';
|
|
1126
|
+
|
|
1091
1127
|
/**
|
|
1092
1128
|
* Determine if a value is a Blob
|
|
1093
1129
|
*
|
|
@@ -1122,17 +1158,28 @@ const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
|
|
|
1122
1158
|
*
|
|
1123
1159
|
* @returns {boolean} True if value is an FormData, otherwise false
|
|
1124
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
|
+
|
|
1125
1172
|
const isFormData = (thing) => {
|
|
1126
1173
|
let kind;
|
|
1127
1174
|
return thing && (
|
|
1128
|
-
(
|
|
1175
|
+
(FormDataCtor && thing instanceof FormDataCtor) || (
|
|
1129
1176
|
isFunction$1(thing.append) && (
|
|
1130
1177
|
(kind = kindOf(thing)) === 'formdata' ||
|
|
1131
1178
|
// detect form-data instance
|
|
1132
1179
|
(kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
|
|
1133
1180
|
)
|
|
1134
1181
|
)
|
|
1135
|
-
)
|
|
1182
|
+
);
|
|
1136
1183
|
};
|
|
1137
1184
|
|
|
1138
1185
|
/**
|
|
@@ -1144,7 +1191,12 @@ const isFormData = (thing) => {
|
|
|
1144
1191
|
*/
|
|
1145
1192
|
const isURLSearchParams = kindOfTest('URLSearchParams');
|
|
1146
1193
|
|
|
1147
|
-
const [isReadableStream, isRequest, isResponse, isHeaders] = [
|
|
1194
|
+
const [isReadableStream, isRequest, isResponse, isHeaders] = [
|
|
1195
|
+
'ReadableStream',
|
|
1196
|
+
'Request',
|
|
1197
|
+
'Response',
|
|
1198
|
+
'Headers',
|
|
1199
|
+
].map(kindOfTest);
|
|
1148
1200
|
|
|
1149
1201
|
/**
|
|
1150
1202
|
* Trim excess whitespace off the beginning and end of a string
|
|
@@ -1153,9 +1205,9 @@ const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream',
|
|
|
1153
1205
|
*
|
|
1154
1206
|
* @returns {String} The String freed of excess whitespace
|
|
1155
1207
|
*/
|
|
1156
|
-
const trim = (str) =>
|
|
1157
|
-
str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
|
1158
|
-
|
|
1208
|
+
const trim = (str) => {
|
|
1209
|
+
return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
|
1210
|
+
};
|
|
1159
1211
|
/**
|
|
1160
1212
|
* Iterate over an Array or an Object invoking a function for each item.
|
|
1161
1213
|
*
|
|
@@ -1165,13 +1217,14 @@ const trim = (str) => str.trim ?
|
|
|
1165
1217
|
* If 'obj' is an Object callback will be called passing
|
|
1166
1218
|
* the value, key, and complete object for each property.
|
|
1167
1219
|
*
|
|
1168
|
-
* @param {Object|Array} obj The object to iterate
|
|
1220
|
+
* @param {Object|Array<unknown>} obj The object to iterate
|
|
1169
1221
|
* @param {Function} fn The callback to invoke for each item
|
|
1170
1222
|
*
|
|
1171
|
-
* @param {
|
|
1223
|
+
* @param {Object} [options]
|
|
1224
|
+
* @param {Boolean} [options.allOwnKeys = false]
|
|
1172
1225
|
* @returns {any}
|
|
1173
1226
|
*/
|
|
1174
|
-
function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
1227
|
+
function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
1175
1228
|
// Don't bother if no value provided
|
|
1176
1229
|
if (obj === null || typeof obj === 'undefined') {
|
|
1177
1230
|
return;
|
|
@@ -1209,8 +1262,16 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
|
1209
1262
|
}
|
|
1210
1263
|
}
|
|
1211
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
|
+
*/
|
|
1212
1273
|
function findKey(obj, key) {
|
|
1213
|
-
if (isBuffer(obj)){
|
|
1274
|
+
if (isBuffer(obj)) {
|
|
1214
1275
|
return null;
|
|
1215
1276
|
}
|
|
1216
1277
|
|
|
@@ -1229,8 +1290,8 @@ function findKey(obj, key) {
|
|
|
1229
1290
|
|
|
1230
1291
|
const _global = (() => {
|
|
1231
1292
|
/*eslint no-undef:0*/
|
|
1232
|
-
if (typeof globalThis !==
|
|
1233
|
-
return typeof self !==
|
|
1293
|
+
if (typeof globalThis !== 'undefined') return globalThis;
|
|
1294
|
+
return typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : __webpack_require__.g;
|
|
1234
1295
|
})();
|
|
1235
1296
|
|
|
1236
1297
|
const isContextDefined = (context) => !isUndefined(context) && context !== _global;
|
|
@@ -1245,7 +1306,7 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
|
|
|
1245
1306
|
* Example:
|
|
1246
1307
|
*
|
|
1247
1308
|
* ```js
|
|
1248
|
-
*
|
|
1309
|
+
* const result = merge({foo: 123}, {foo: 456});
|
|
1249
1310
|
* console.log(result.foo); // outputs 456
|
|
1250
1311
|
* ```
|
|
1251
1312
|
*
|
|
@@ -1254,10 +1315,15 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
|
|
|
1254
1315
|
* @returns {Object} Result of all merge properties
|
|
1255
1316
|
*/
|
|
1256
1317
|
function merge(/* obj1, obj2, obj3, ... */) {
|
|
1257
|
-
const {caseless, skipUndefined} = isContextDefined(this) && this || {};
|
|
1318
|
+
const { caseless, skipUndefined } = (isContextDefined(this) && this) || {};
|
|
1258
1319
|
const result = {};
|
|
1259
1320
|
const assignValue = (val, key) => {
|
|
1260
|
-
|
|
1321
|
+
// Skip dangerous property names to prevent prototype pollution
|
|
1322
|
+
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
|
1323
|
+
return;
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
const targetKey = (caseless && findKey(result, key)) || key;
|
|
1261
1327
|
if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
|
|
1262
1328
|
result[targetKey] = merge(result[targetKey], val);
|
|
1263
1329
|
} else if (isPlainObject(val)) {
|
|
@@ -1282,17 +1348,32 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
1282
1348
|
* @param {Object} b The object to copy properties from
|
|
1283
1349
|
* @param {Object} thisArg The object to bind function to
|
|
1284
1350
|
*
|
|
1285
|
-
* @param {
|
|
1351
|
+
* @param {Object} [options]
|
|
1352
|
+
* @param {Boolean} [options.allOwnKeys]
|
|
1286
1353
|
* @returns {Object} The resulting value of object a
|
|
1287
1354
|
*/
|
|
1288
|
-
const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
|
|
1289
|
-
forEach(
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1355
|
+
const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
|
|
1356
|
+
forEach(
|
|
1357
|
+
b,
|
|
1358
|
+
(val, key) => {
|
|
1359
|
+
if (thisArg && isFunction$1(val)) {
|
|
1360
|
+
Object.defineProperty(a, key, {
|
|
1361
|
+
value: bind(val, thisArg),
|
|
1362
|
+
writable: true,
|
|
1363
|
+
enumerable: true,
|
|
1364
|
+
configurable: true,
|
|
1365
|
+
});
|
|
1366
|
+
} else {
|
|
1367
|
+
Object.defineProperty(a, key, {
|
|
1368
|
+
value: val,
|
|
1369
|
+
writable: true,
|
|
1370
|
+
enumerable: true,
|
|
1371
|
+
configurable: true,
|
|
1372
|
+
});
|
|
1373
|
+
}
|
|
1374
|
+
},
|
|
1375
|
+
{ allOwnKeys }
|
|
1376
|
+
);
|
|
1296
1377
|
return a;
|
|
1297
1378
|
};
|
|
1298
1379
|
|
|
@@ -1304,7 +1385,7 @@ const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
|
|
|
1304
1385
|
* @returns {string} content value without BOM
|
|
1305
1386
|
*/
|
|
1306
1387
|
const stripBOM = (content) => {
|
|
1307
|
-
if (content.charCodeAt(0) ===
|
|
1388
|
+
if (content.charCodeAt(0) === 0xfeff) {
|
|
1308
1389
|
content = content.slice(1);
|
|
1309
1390
|
}
|
|
1310
1391
|
return content;
|
|
@@ -1321,9 +1402,14 @@ const stripBOM = (content) => {
|
|
|
1321
1402
|
*/
|
|
1322
1403
|
const inherits = (constructor, superConstructor, props, descriptors) => {
|
|
1323
1404
|
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
|
1324
|
-
constructor.prototype
|
|
1405
|
+
Object.defineProperty(constructor.prototype, 'constructor', {
|
|
1406
|
+
value: constructor,
|
|
1407
|
+
writable: true,
|
|
1408
|
+
enumerable: false,
|
|
1409
|
+
configurable: true,
|
|
1410
|
+
});
|
|
1325
1411
|
Object.defineProperty(constructor, 'super', {
|
|
1326
|
-
value: superConstructor.prototype
|
|
1412
|
+
value: superConstructor.prototype,
|
|
1327
1413
|
});
|
|
1328
1414
|
props && Object.assign(constructor.prototype, props);
|
|
1329
1415
|
};
|
|
@@ -1382,7 +1468,6 @@ const endsWith = (str, searchString, position) => {
|
|
|
1382
1468
|
return lastIndex !== -1 && lastIndex === position;
|
|
1383
1469
|
};
|
|
1384
1470
|
|
|
1385
|
-
|
|
1386
1471
|
/**
|
|
1387
1472
|
* Returns new array from array like object or null if failed
|
|
1388
1473
|
*
|
|
@@ -1411,9 +1496,9 @@ const toArray = (thing) => {
|
|
|
1411
1496
|
* @returns {Array}
|
|
1412
1497
|
*/
|
|
1413
1498
|
// eslint-disable-next-line func-names
|
|
1414
|
-
const isTypedArray = (TypedArray => {
|
|
1499
|
+
const isTypedArray = ((TypedArray) => {
|
|
1415
1500
|
// eslint-disable-next-line func-names
|
|
1416
|
-
return thing => {
|
|
1501
|
+
return (thing) => {
|
|
1417
1502
|
return TypedArray && thing instanceof TypedArray;
|
|
1418
1503
|
};
|
|
1419
1504
|
})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
|
|
@@ -1461,16 +1546,18 @@ const matchAll = (regExp, str) => {
|
|
|
1461
1546
|
/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
|
|
1462
1547
|
const isHTMLForm = kindOfTest('HTMLFormElement');
|
|
1463
1548
|
|
|
1464
|
-
const toCamelCase = str => {
|
|
1465
|
-
return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
}
|
|
1469
|
-
);
|
|
1549
|
+
const toCamelCase = (str) => {
|
|
1550
|
+
return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
|
|
1551
|
+
return p1.toUpperCase() + p2;
|
|
1552
|
+
});
|
|
1470
1553
|
};
|
|
1471
1554
|
|
|
1472
1555
|
/* Creating a function that will check if an object has a property. */
|
|
1473
|
-
const hasOwnProperty = (
|
|
1556
|
+
const hasOwnProperty = (
|
|
1557
|
+
({ hasOwnProperty }) =>
|
|
1558
|
+
(obj, prop) =>
|
|
1559
|
+
hasOwnProperty.call(obj, prop)
|
|
1560
|
+
)(Object.prototype);
|
|
1474
1561
|
|
|
1475
1562
|
/**
|
|
1476
1563
|
* Determine if a value is a RegExp object
|
|
@@ -1520,17 +1607,25 @@ const freezeMethods = (obj) => {
|
|
|
1520
1607
|
|
|
1521
1608
|
if (!descriptor.set) {
|
|
1522
1609
|
descriptor.set = () => {
|
|
1523
|
-
throw Error(
|
|
1610
|
+
throw Error("Can not rewrite read-only method '" + name + "'");
|
|
1524
1611
|
};
|
|
1525
1612
|
}
|
|
1526
1613
|
});
|
|
1527
1614
|
};
|
|
1528
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
|
+
*/
|
|
1529
1624
|
const toObjectSet = (arrayOrString, delimiter) => {
|
|
1530
1625
|
const obj = {};
|
|
1531
1626
|
|
|
1532
1627
|
const define = (arr) => {
|
|
1533
|
-
arr.forEach(value => {
|
|
1628
|
+
arr.forEach((value) => {
|
|
1534
1629
|
obj[value] = true;
|
|
1535
1630
|
});
|
|
1536
1631
|
};
|
|
@@ -1543,11 +1638,9 @@ const toObjectSet = (arrayOrString, delimiter) => {
|
|
|
1543
1638
|
const noop = () => {};
|
|
1544
1639
|
|
|
1545
1640
|
const toFiniteNumber = (value, defaultValue) => {
|
|
1546
|
-
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
|
|
1641
|
+
return value != null && Number.isFinite((value = +value)) ? value : defaultValue;
|
|
1547
1642
|
};
|
|
1548
1643
|
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
1644
|
/**
|
|
1552
1645
|
* If the thing is a FormData object, return true, otherwise return false.
|
|
1553
1646
|
*
|
|
@@ -1556,14 +1649,24 @@ const toFiniteNumber = (value, defaultValue) => {
|
|
|
1556
1649
|
* @returns {boolean}
|
|
1557
1650
|
*/
|
|
1558
1651
|
function isSpecCompliantForm(thing) {
|
|
1559
|
-
return !!(
|
|
1652
|
+
return !!(
|
|
1653
|
+
thing &&
|
|
1654
|
+
isFunction$1(thing.append) &&
|
|
1655
|
+
thing[toStringTag] === 'FormData' &&
|
|
1656
|
+
thing[iterator]
|
|
1657
|
+
);
|
|
1560
1658
|
}
|
|
1561
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
|
+
*/
|
|
1562
1666
|
const toJSONObject = (obj) => {
|
|
1563
1667
|
const stack = new Array(10);
|
|
1564
1668
|
|
|
1565
1669
|
const visit = (source, i) => {
|
|
1566
|
-
|
|
1567
1670
|
if (isObject(source)) {
|
|
1568
1671
|
if (stack.indexOf(source) >= 0) {
|
|
1569
1672
|
return;
|
|
@@ -1574,7 +1677,7 @@ const toJSONObject = (obj) => {
|
|
|
1574
1677
|
return source;
|
|
1575
1678
|
}
|
|
1576
1679
|
|
|
1577
|
-
if(!('toJSON' in source)) {
|
|
1680
|
+
if (!('toJSON' in source)) {
|
|
1578
1681
|
stack[i] = source;
|
|
1579
1682
|
const target = isArray(source) ? [] : {};
|
|
1580
1683
|
|
|
@@ -1595,45 +1698,77 @@ const toJSONObject = (obj) => {
|
|
|
1595
1698
|
return visit(obj, 0);
|
|
1596
1699
|
};
|
|
1597
1700
|
|
|
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
|
+
*/
|
|
1598
1707
|
const isAsyncFn = kindOfTest('AsyncFunction');
|
|
1599
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
|
+
*/
|
|
1600
1715
|
const isThenable = (thing) =>
|
|
1601
|
-
thing &&
|
|
1716
|
+
thing &&
|
|
1717
|
+
(isObject(thing) || isFunction$1(thing)) &&
|
|
1718
|
+
isFunction$1(thing.then) &&
|
|
1719
|
+
isFunction$1(thing.catch);
|
|
1602
1720
|
|
|
1603
1721
|
// original code
|
|
1604
1722
|
// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
|
|
1605
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
|
+
*/
|
|
1606
1732
|
const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
1607
1733
|
if (setImmediateSupported) {
|
|
1608
1734
|
return setImmediate;
|
|
1609
1735
|
}
|
|
1610
1736
|
|
|
1611
|
-
return postMessageSupported
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1737
|
+
return postMessageSupported
|
|
1738
|
+
? ((token, callbacks) => {
|
|
1739
|
+
_global.addEventListener(
|
|
1740
|
+
'message',
|
|
1741
|
+
({ source, data }) => {
|
|
1742
|
+
if (source === _global && data === token) {
|
|
1743
|
+
callbacks.length && callbacks.shift()();
|
|
1744
|
+
}
|
|
1745
|
+
},
|
|
1746
|
+
false
|
|
1747
|
+
);
|
|
1617
1748
|
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
isFunction$1(_global.postMessage)
|
|
1626
|
-
);
|
|
1749
|
+
return (cb) => {
|
|
1750
|
+
callbacks.push(cb);
|
|
1751
|
+
_global.postMessage(token, '*');
|
|
1752
|
+
};
|
|
1753
|
+
})(`axios@${Math.random()}`, [])
|
|
1754
|
+
: (cb) => setTimeout(cb);
|
|
1755
|
+
})(typeof setImmediate === 'function', isFunction$1(_global.postMessage));
|
|
1627
1756
|
|
|
1628
|
-
|
|
1629
|
-
|
|
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
|
+
*/
|
|
1763
|
+
const asap =
|
|
1764
|
+
typeof queueMicrotask !== 'undefined'
|
|
1765
|
+
? queueMicrotask.bind(_global)
|
|
1766
|
+
: (typeof process !== 'undefined' && process.nextTick) || _setImmediate;
|
|
1630
1767
|
|
|
1631
1768
|
// *********************
|
|
1632
1769
|
|
|
1633
|
-
|
|
1634
1770
|
const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
|
|
1635
1771
|
|
|
1636
|
-
|
|
1637
1772
|
var utils$1 = {
|
|
1638
1773
|
isArray,
|
|
1639
1774
|
isArrayBuffer,
|
|
@@ -1653,6 +1788,8 @@ var utils$1 = {
|
|
|
1653
1788
|
isUndefined,
|
|
1654
1789
|
isDate,
|
|
1655
1790
|
isFile,
|
|
1791
|
+
isReactNativeBlob,
|
|
1792
|
+
isReactNative,
|
|
1656
1793
|
isBlob,
|
|
1657
1794
|
isRegExp,
|
|
1658
1795
|
isFunction: isFunction$1,
|
|
@@ -1691,42 +1828,60 @@ var utils$1 = {
|
|
|
1691
1828
|
isThenable,
|
|
1692
1829
|
setImmediate: _setImmediate,
|
|
1693
1830
|
asap,
|
|
1694
|
-
isIterable
|
|
1831
|
+
isIterable,
|
|
1695
1832
|
};
|
|
1696
1833
|
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
* @param {Object} [config] The config.
|
|
1703
|
-
* @param {Object} [request] The request.
|
|
1704
|
-
* @param {Object} [response] The response.
|
|
1705
|
-
*
|
|
1706
|
-
* @returns {Error} The created error.
|
|
1707
|
-
*/
|
|
1708
|
-
function AxiosError(message, code, config, request, response) {
|
|
1709
|
-
Error.call(this);
|
|
1834
|
+
class AxiosError extends Error {
|
|
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;
|
|
1710
1839
|
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
}
|
|
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;
|
|
1843
|
+
}
|
|
1716
1844
|
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
code && (this.code = code);
|
|
1720
|
-
config && (this.config = config);
|
|
1721
|
-
request && (this.request = request);
|
|
1722
|
-
if (response) {
|
|
1723
|
-
this.response = response;
|
|
1724
|
-
this.status = response.status ? response.status : null;
|
|
1845
|
+
customProps && Object.assign(axiosError, customProps);
|
|
1846
|
+
return axiosError;
|
|
1725
1847
|
}
|
|
1726
|
-
}
|
|
1727
1848
|
|
|
1728
|
-
|
|
1729
|
-
|
|
1849
|
+
/**
|
|
1850
|
+
* Create an Error with the specified message, config, error code, request and response.
|
|
1851
|
+
*
|
|
1852
|
+
* @param {string} message The error message.
|
|
1853
|
+
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
1854
|
+
* @param {Object} [config] The config.
|
|
1855
|
+
* @param {Object} [request] The request.
|
|
1856
|
+
* @param {Object} [response] The response.
|
|
1857
|
+
*
|
|
1858
|
+
* @returns {Error} The created error.
|
|
1859
|
+
*/
|
|
1860
|
+
constructor(message, code, config, request, response) {
|
|
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
|
+
}
|
|
1882
|
+
}
|
|
1883
|
+
|
|
1884
|
+
toJSON() {
|
|
1730
1885
|
return {
|
|
1731
1886
|
// Standard
|
|
1732
1887
|
message: this.message,
|
|
@@ -1742,62 +1897,24 @@ utils$1.inherits(AxiosError, Error, {
|
|
|
1742
1897
|
// Axios
|
|
1743
1898
|
config: utils$1.toJSONObject(this.config),
|
|
1744
1899
|
code: this.code,
|
|
1745
|
-
status: this.status
|
|
1900
|
+
status: this.status,
|
|
1746
1901
|
};
|
|
1747
1902
|
}
|
|
1748
|
-
}
|
|
1749
|
-
|
|
1750
|
-
const prototype$1 = AxiosError.prototype;
|
|
1751
|
-
const descriptors = {};
|
|
1752
|
-
|
|
1753
|
-
[
|
|
1754
|
-
'ERR_BAD_OPTION_VALUE',
|
|
1755
|
-
'ERR_BAD_OPTION',
|
|
1756
|
-
'ECONNABORTED',
|
|
1757
|
-
'ETIMEDOUT',
|
|
1758
|
-
'ERR_NETWORK',
|
|
1759
|
-
'ERR_FR_TOO_MANY_REDIRECTS',
|
|
1760
|
-
'ERR_DEPRECATED',
|
|
1761
|
-
'ERR_BAD_RESPONSE',
|
|
1762
|
-
'ERR_BAD_REQUEST',
|
|
1763
|
-
'ERR_CANCELED',
|
|
1764
|
-
'ERR_NOT_SUPPORT',
|
|
1765
|
-
'ERR_INVALID_URL'
|
|
1766
|
-
// eslint-disable-next-line func-names
|
|
1767
|
-
].forEach(code => {
|
|
1768
|
-
descriptors[code] = {value: code};
|
|
1769
|
-
});
|
|
1770
|
-
|
|
1771
|
-
Object.defineProperties(AxiosError, descriptors);
|
|
1772
|
-
Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
|
|
1773
|
-
|
|
1774
|
-
// eslint-disable-next-line func-names
|
|
1775
|
-
AxiosError.from = (error, code, config, request, response, customProps) => {
|
|
1776
|
-
const axiosError = Object.create(prototype$1);
|
|
1777
|
-
|
|
1778
|
-
utils$1.toFlatObject(error, axiosError, function filter(obj) {
|
|
1779
|
-
return obj !== Error.prototype;
|
|
1780
|
-
}, prop => {
|
|
1781
|
-
return prop !== 'isAxiosError';
|
|
1782
|
-
});
|
|
1783
|
-
|
|
1784
|
-
const msg = error && error.message ? error.message : 'Error';
|
|
1785
|
-
|
|
1786
|
-
// Prefer explicit code; otherwise copy the low-level error's code (e.g. ECONNREFUSED)
|
|
1787
|
-
const errCode = code == null && error ? error.code : code;
|
|
1788
|
-
AxiosError.call(axiosError, msg, errCode, config, request, response);
|
|
1789
|
-
|
|
1790
|
-
// Chain the original error on the standard field; non-enumerable to avoid JSON noise
|
|
1791
|
-
if (error && axiosError.cause == null) {
|
|
1792
|
-
Object.defineProperty(axiosError, 'cause', { value: error, configurable: true });
|
|
1793
|
-
}
|
|
1794
|
-
|
|
1795
|
-
axiosError.name = (error && error.name) || 'Error';
|
|
1903
|
+
}
|
|
1796
1904
|
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1905
|
+
// This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
|
|
1906
|
+
AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
|
|
1907
|
+
AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
|
|
1908
|
+
AxiosError.ECONNABORTED = 'ECONNABORTED';
|
|
1909
|
+
AxiosError.ETIMEDOUT = 'ETIMEDOUT';
|
|
1910
|
+
AxiosError.ERR_NETWORK = 'ERR_NETWORK';
|
|
1911
|
+
AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
|
|
1912
|
+
AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
|
|
1913
|
+
AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
|
|
1914
|
+
AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
|
|
1915
|
+
AxiosError.ERR_CANCELED = 'ERR_CANCELED';
|
|
1916
|
+
AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
|
|
1917
|
+
AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
|
|
1801
1918
|
|
|
1802
1919
|
// eslint-disable-next-line strict
|
|
1803
1920
|
var httpAdapter = null;
|
|
@@ -1835,11 +1952,14 @@ function removeBrackets(key) {
|
|
|
1835
1952
|
*/
|
|
1836
1953
|
function renderKey(path, key, dots) {
|
|
1837
1954
|
if (!path) return key;
|
|
1838
|
-
return path
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
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 ? '.' : '');
|
|
1843
1963
|
}
|
|
1844
1964
|
|
|
1845
1965
|
/**
|
|
@@ -1889,21 +2009,26 @@ function toFormData(obj, formData, options) {
|
|
|
1889
2009
|
formData = formData || new (FormData)();
|
|
1890
2010
|
|
|
1891
2011
|
// eslint-disable-next-line no-param-reassign
|
|
1892
|
-
options = utils$1.toFlatObject(
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
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
|
+
);
|
|
1900
2025
|
|
|
1901
2026
|
const metaTokens = options.metaTokens;
|
|
1902
2027
|
// eslint-disable-next-line no-use-before-define
|
|
1903
2028
|
const visitor = options.visitor || defaultVisitor;
|
|
1904
2029
|
const dots = options.dots;
|
|
1905
2030
|
const indexes = options.indexes;
|
|
1906
|
-
const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
|
|
2031
|
+
const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
|
|
1907
2032
|
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
|
|
1908
2033
|
|
|
1909
2034
|
if (!utils$1.isFunction(visitor)) {
|
|
@@ -1945,6 +2070,11 @@ function toFormData(obj, formData, options) {
|
|
|
1945
2070
|
function defaultVisitor(value, key, path) {
|
|
1946
2071
|
let arr = value;
|
|
1947
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
|
+
|
|
1948
2078
|
if (value && !path && typeof value === 'object') {
|
|
1949
2079
|
if (utils$1.endsWith(key, '{}')) {
|
|
1950
2080
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -1953,17 +2083,22 @@ function toFormData(obj, formData, options) {
|
|
|
1953
2083
|
value = JSON.stringify(value);
|
|
1954
2084
|
} else if (
|
|
1955
2085
|
(utils$1.isArray(value) && isFlatArray(value)) ||
|
|
1956
|
-
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
|
|
1957
|
-
|
|
2086
|
+
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
|
|
2087
|
+
) {
|
|
1958
2088
|
// eslint-disable-next-line no-param-reassign
|
|
1959
2089
|
key = removeBrackets(key);
|
|
1960
2090
|
|
|
1961
2091
|
arr.forEach(function each(el, index) {
|
|
1962
|
-
!(utils$1.isUndefined(el) || el === null) &&
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
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
|
+
);
|
|
1967
2102
|
});
|
|
1968
2103
|
return false;
|
|
1969
2104
|
}
|
|
@@ -1983,7 +2118,7 @@ function toFormData(obj, formData, options) {
|
|
|
1983
2118
|
const exposedHelpers = Object.assign(predicates, {
|
|
1984
2119
|
defaultVisitor,
|
|
1985
2120
|
convertValue,
|
|
1986
|
-
isVisitable
|
|
2121
|
+
isVisitable,
|
|
1987
2122
|
});
|
|
1988
2123
|
|
|
1989
2124
|
function build(value, path) {
|
|
@@ -1996,9 +2131,9 @@ function toFormData(obj, formData, options) {
|
|
|
1996
2131
|
stack.push(value);
|
|
1997
2132
|
|
|
1998
2133
|
utils$1.forEach(value, function each(el, key) {
|
|
1999
|
-
const result =
|
|
2000
|
-
|
|
2001
|
-
|
|
2134
|
+
const result =
|
|
2135
|
+
!(utils$1.isUndefined(el) || el === null) &&
|
|
2136
|
+
visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
|
|
2002
2137
|
|
|
2003
2138
|
if (result === true) {
|
|
2004
2139
|
build(el, path ? path.concat(key) : [key]);
|
|
@@ -2033,7 +2168,7 @@ function encode$1(str) {
|
|
|
2033
2168
|
')': '%29',
|
|
2034
2169
|
'~': '%7E',
|
|
2035
2170
|
'%20': '+',
|
|
2036
|
-
'%00': '\x00'
|
|
2171
|
+
'%00': '\x00',
|
|
2037
2172
|
};
|
|
2038
2173
|
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
|
2039
2174
|
return charMap[match];
|
|
@@ -2061,29 +2196,33 @@ prototype.append = function append(name, value) {
|
|
|
2061
2196
|
};
|
|
2062
2197
|
|
|
2063
2198
|
prototype.toString = function toString(encoder) {
|
|
2064
|
-
const _encode = encoder
|
|
2065
|
-
|
|
2066
|
-
|
|
2199
|
+
const _encode = encoder
|
|
2200
|
+
? function (value) {
|
|
2201
|
+
return encoder.call(this, value, encode$1);
|
|
2202
|
+
}
|
|
2203
|
+
: encode$1;
|
|
2067
2204
|
|
|
2068
|
-
return this._pairs
|
|
2069
|
-
|
|
2070
|
-
|
|
2205
|
+
return this._pairs
|
|
2206
|
+
.map(function each(pair) {
|
|
2207
|
+
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
|
2208
|
+
}, '')
|
|
2209
|
+
.join('&');
|
|
2071
2210
|
};
|
|
2072
2211
|
|
|
2073
2212
|
/**
|
|
2074
|
-
* It replaces
|
|
2075
|
-
*
|
|
2213
|
+
* It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
|
|
2214
|
+
* their plain counterparts (`:`, `$`, `,`, `+`).
|
|
2076
2215
|
*
|
|
2077
2216
|
* @param {string} val The value to be encoded.
|
|
2078
2217
|
*
|
|
2079
2218
|
* @returns {string} The encoded value.
|
|
2080
2219
|
*/
|
|
2081
2220
|
function encode(val) {
|
|
2082
|
-
return encodeURIComponent(val)
|
|
2083
|
-
replace(/%3A/gi, ':')
|
|
2084
|
-
replace(/%24/g, '$')
|
|
2085
|
-
replace(/%2C/gi, ',')
|
|
2086
|
-
replace(/%20/g, '+');
|
|
2221
|
+
return encodeURIComponent(val)
|
|
2222
|
+
.replace(/%3A/gi, ':')
|
|
2223
|
+
.replace(/%24/g, '$')
|
|
2224
|
+
.replace(/%2C/gi, ',')
|
|
2225
|
+
.replace(/%20/g, '+');
|
|
2087
2226
|
}
|
|
2088
2227
|
|
|
2089
2228
|
/**
|
|
@@ -2096,33 +2235,32 @@ function encode(val) {
|
|
|
2096
2235
|
* @returns {string} The formatted url
|
|
2097
2236
|
*/
|
|
2098
2237
|
function buildURL(url, params, options) {
|
|
2099
|
-
/*eslint no-param-reassign:0*/
|
|
2100
2238
|
if (!params) {
|
|
2101
2239
|
return url;
|
|
2102
2240
|
}
|
|
2103
|
-
|
|
2104
|
-
const _encode = options && options.encode || encode;
|
|
2105
2241
|
|
|
2106
|
-
|
|
2107
|
-
options = {
|
|
2108
|
-
serialize: options
|
|
2109
|
-
};
|
|
2110
|
-
}
|
|
2242
|
+
const _encode = (options && options.encode) || encode;
|
|
2111
2243
|
|
|
2112
|
-
const
|
|
2244
|
+
const _options = utils$1.isFunction(options)
|
|
2245
|
+
? {
|
|
2246
|
+
serialize: options,
|
|
2247
|
+
}
|
|
2248
|
+
: options;
|
|
2249
|
+
|
|
2250
|
+
const serializeFn = _options && _options.serialize;
|
|
2113
2251
|
|
|
2114
2252
|
let serializedParams;
|
|
2115
2253
|
|
|
2116
2254
|
if (serializeFn) {
|
|
2117
|
-
serializedParams = serializeFn(params,
|
|
2255
|
+
serializedParams = serializeFn(params, _options);
|
|
2118
2256
|
} else {
|
|
2119
|
-
serializedParams = utils$1.isURLSearchParams(params)
|
|
2120
|
-
params.toString()
|
|
2121
|
-
new AxiosURLSearchParams(params,
|
|
2257
|
+
serializedParams = utils$1.isURLSearchParams(params)
|
|
2258
|
+
? params.toString()
|
|
2259
|
+
: new AxiosURLSearchParams(params, _options).toString(_encode);
|
|
2122
2260
|
}
|
|
2123
2261
|
|
|
2124
2262
|
if (serializedParams) {
|
|
2125
|
-
const hashmarkIndex = url.indexOf(
|
|
2263
|
+
const hashmarkIndex = url.indexOf('#');
|
|
2126
2264
|
|
|
2127
2265
|
if (hashmarkIndex !== -1) {
|
|
2128
2266
|
url = url.slice(0, hashmarkIndex);
|
|
@@ -2143,6 +2281,7 @@ class InterceptorManager {
|
|
|
2143
2281
|
*
|
|
2144
2282
|
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
2145
2283
|
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
2284
|
+
* @param {Object} options The options for the interceptor, synchronous and runWhen
|
|
2146
2285
|
*
|
|
2147
2286
|
* @return {Number} An ID used to remove interceptor later
|
|
2148
2287
|
*/
|
|
@@ -2151,7 +2290,7 @@ class InterceptorManager {
|
|
|
2151
2290
|
fulfilled,
|
|
2152
2291
|
rejected,
|
|
2153
2292
|
synchronous: options ? options.synchronous : false,
|
|
2154
|
-
runWhen: options ? options.runWhen : null
|
|
2293
|
+
runWhen: options ? options.runWhen : null,
|
|
2155
2294
|
});
|
|
2156
2295
|
return this.handlers.length - 1;
|
|
2157
2296
|
}
|
|
@@ -2199,12 +2338,11 @@ class InterceptorManager {
|
|
|
2199
2338
|
}
|
|
2200
2339
|
}
|
|
2201
2340
|
|
|
2202
|
-
var InterceptorManager$1 = InterceptorManager;
|
|
2203
|
-
|
|
2204
2341
|
var transitionalDefaults = {
|
|
2205
2342
|
silentJSONParsing: true,
|
|
2206
2343
|
forcedJSONParsing: true,
|
|
2207
|
-
clarifyTimeoutError: false
|
|
2344
|
+
clarifyTimeoutError: false,
|
|
2345
|
+
legacyInterceptorReqResOrdering: true,
|
|
2208
2346
|
};
|
|
2209
2347
|
|
|
2210
2348
|
var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
|
|
@@ -2218,14 +2356,14 @@ var platform$1 = {
|
|
|
2218
2356
|
classes: {
|
|
2219
2357
|
URLSearchParams: URLSearchParams$1,
|
|
2220
2358
|
FormData: FormData$1,
|
|
2221
|
-
Blob: Blob$1
|
|
2359
|
+
Blob: Blob$1,
|
|
2222
2360
|
},
|
|
2223
|
-
protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
|
|
2361
|
+
protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],
|
|
2224
2362
|
};
|
|
2225
2363
|
|
|
2226
2364
|
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
2227
2365
|
|
|
2228
|
-
const _navigator = typeof navigator === 'object' && navigator || undefined;
|
|
2366
|
+
const _navigator = (typeof navigator === 'object' && navigator) || undefined;
|
|
2229
2367
|
|
|
2230
2368
|
/**
|
|
2231
2369
|
* Determine if we're running in a standard browser environment
|
|
@@ -2244,7 +2382,8 @@ const _navigator = typeof navigator === 'object' && navigator || undefined;
|
|
|
2244
2382
|
*
|
|
2245
2383
|
* @returns {boolean}
|
|
2246
2384
|
*/
|
|
2247
|
-
const hasStandardBrowserEnv =
|
|
2385
|
+
const hasStandardBrowserEnv =
|
|
2386
|
+
hasBrowserEnv &&
|
|
2248
2387
|
(!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
|
|
2249
2388
|
|
|
2250
2389
|
/**
|
|
@@ -2265,25 +2404,25 @@ const hasStandardBrowserWebWorkerEnv = (() => {
|
|
|
2265
2404
|
);
|
|
2266
2405
|
})();
|
|
2267
2406
|
|
|
2268
|
-
const origin = hasBrowserEnv && window.location.href || 'http://localhost';
|
|
2407
|
+
const origin = (hasBrowserEnv && window.location.href) || 'http://localhost';
|
|
2269
2408
|
|
|
2270
2409
|
var utils = /*#__PURE__*/Object.freeze({
|
|
2271
2410
|
__proto__: null,
|
|
2272
2411
|
hasBrowserEnv: hasBrowserEnv,
|
|
2273
|
-
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
|
|
2274
2412
|
hasStandardBrowserEnv: hasStandardBrowserEnv,
|
|
2413
|
+
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
|
|
2275
2414
|
navigator: _navigator,
|
|
2276
2415
|
origin: origin
|
|
2277
2416
|
});
|
|
2278
2417
|
|
|
2279
2418
|
var platform = {
|
|
2280
2419
|
...utils,
|
|
2281
|
-
...platform$1
|
|
2420
|
+
...platform$1,
|
|
2282
2421
|
};
|
|
2283
2422
|
|
|
2284
2423
|
function toURLEncodedForm(data, options) {
|
|
2285
2424
|
return toFormData(data, new platform.classes.URLSearchParams(), {
|
|
2286
|
-
visitor: function(value, key, path, helpers) {
|
|
2425
|
+
visitor: function (value, key, path, helpers) {
|
|
2287
2426
|
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
2288
2427
|
this.append(key, value.toString('base64'));
|
|
2289
2428
|
return false;
|
|
@@ -2291,7 +2430,7 @@ function toURLEncodedForm(data, options) {
|
|
|
2291
2430
|
|
|
2292
2431
|
return helpers.defaultVisitor.apply(this, arguments);
|
|
2293
2432
|
},
|
|
2294
|
-
...options
|
|
2433
|
+
...options,
|
|
2295
2434
|
});
|
|
2296
2435
|
}
|
|
2297
2436
|
|
|
@@ -2307,7 +2446,7 @@ function parsePropPath(name) {
|
|
|
2307
2446
|
// foo.x.y.z
|
|
2308
2447
|
// foo-x-y-z
|
|
2309
2448
|
// foo x y z
|
|
2310
|
-
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
|
|
2449
|
+
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
|
|
2311
2450
|
return match[0] === '[]' ? '' : match[1] || match[0];
|
|
2312
2451
|
});
|
|
2313
2452
|
}
|
|
@@ -2411,96 +2550,107 @@ function stringifySafely(rawValue, parser, encoder) {
|
|
|
2411
2550
|
}
|
|
2412
2551
|
|
|
2413
2552
|
const defaults = {
|
|
2414
|
-
|
|
2415
2553
|
transitional: transitionalDefaults,
|
|
2416
2554
|
|
|
2417
2555
|
adapter: ['xhr', 'http', 'fetch'],
|
|
2418
2556
|
|
|
2419
|
-
transformRequest: [
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
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);
|
|
2423
2562
|
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2563
|
+
if (isObjectPayload && utils$1.isHTMLForm(data)) {
|
|
2564
|
+
data = new FormData(data);
|
|
2565
|
+
}
|
|
2427
2566
|
|
|
2428
|
-
|
|
2567
|
+
const isFormData = utils$1.isFormData(data);
|
|
2429
2568
|
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2569
|
+
if (isFormData) {
|
|
2570
|
+
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
2571
|
+
}
|
|
2433
2572
|
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
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
|
+
}
|
|
2450
2590
|
|
|
2451
|
-
|
|
2591
|
+
let isFileList;
|
|
2452
2592
|
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2593
|
+
if (isObjectPayload) {
|
|
2594
|
+
if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
|
|
2595
|
+
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
2596
|
+
}
|
|
2457
2597
|
|
|
2458
|
-
|
|
2459
|
-
|
|
2598
|
+
if (
|
|
2599
|
+
(isFileList = utils$1.isFileList(data)) ||
|
|
2600
|
+
contentType.indexOf('multipart/form-data') > -1
|
|
2601
|
+
) {
|
|
2602
|
+
const _FormData = this.env && this.env.FormData;
|
|
2460
2603
|
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2604
|
+
return toFormData(
|
|
2605
|
+
isFileList ? { 'files[]': data } : data,
|
|
2606
|
+
_FormData && new _FormData(),
|
|
2607
|
+
this.formSerializer
|
|
2608
|
+
);
|
|
2609
|
+
}
|
|
2466
2610
|
}
|
|
2467
|
-
}
|
|
2468
2611
|
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2612
|
+
if (isObjectPayload || hasJSONContentType) {
|
|
2613
|
+
headers.setContentType('application/json', false);
|
|
2614
|
+
return stringifySafely(data);
|
|
2615
|
+
}
|
|
2473
2616
|
|
|
2474
|
-
|
|
2475
|
-
|
|
2617
|
+
return data;
|
|
2618
|
+
},
|
|
2619
|
+
],
|
|
2476
2620
|
|
|
2477
|
-
transformResponse: [
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
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';
|
|
2481
2626
|
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2627
|
+
if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
|
|
2628
|
+
return data;
|
|
2629
|
+
}
|
|
2485
2630
|
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
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;
|
|
2489
2638
|
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
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;
|
|
2496
2647
|
}
|
|
2497
|
-
throw e;
|
|
2498
2648
|
}
|
|
2499
2649
|
}
|
|
2500
|
-
}
|
|
2501
2650
|
|
|
2502
|
-
|
|
2503
|
-
|
|
2651
|
+
return data;
|
|
2652
|
+
},
|
|
2653
|
+
],
|
|
2504
2654
|
|
|
2505
2655
|
/**
|
|
2506
2656
|
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
@@ -2516,7 +2666,7 @@ const defaults = {
|
|
|
2516
2666
|
|
|
2517
2667
|
env: {
|
|
2518
2668
|
FormData: platform.classes.FormData,
|
|
2519
|
-
Blob: platform.classes.Blob
|
|
2669
|
+
Blob: platform.classes.Blob,
|
|
2520
2670
|
},
|
|
2521
2671
|
|
|
2522
2672
|
validateStatus: function validateStatus(status) {
|
|
@@ -2525,25 +2675,36 @@ const defaults = {
|
|
|
2525
2675
|
|
|
2526
2676
|
headers: {
|
|
2527
2677
|
common: {
|
|
2528
|
-
|
|
2529
|
-
'Content-Type': undefined
|
|
2530
|
-
}
|
|
2531
|
-
}
|
|
2678
|
+
Accept: 'application/json, text/plain, */*',
|
|
2679
|
+
'Content-Type': undefined,
|
|
2680
|
+
},
|
|
2681
|
+
},
|
|
2532
2682
|
};
|
|
2533
2683
|
|
|
2534
2684
|
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
|
|
2535
2685
|
defaults.headers[method] = {};
|
|
2536
2686
|
});
|
|
2537
2687
|
|
|
2538
|
-
var defaults$1 = defaults;
|
|
2539
|
-
|
|
2540
2688
|
// RawAxiosHeaders whose duplicates are ignored by node
|
|
2541
2689
|
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
2542
2690
|
const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
2543
|
-
'age',
|
|
2544
|
-
'
|
|
2545
|
-
'
|
|
2546
|
-
'
|
|
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',
|
|
2547
2708
|
]);
|
|
2548
2709
|
|
|
2549
2710
|
/**
|
|
@@ -2560,47 +2721,81 @@ const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
|
2560
2721
|
*
|
|
2561
2722
|
* @returns {Object} Headers parsed into an object
|
|
2562
2723
|
*/
|
|
2563
|
-
var parseHeaders = rawHeaders => {
|
|
2724
|
+
var parseHeaders = (rawHeaders) => {
|
|
2564
2725
|
const parsed = {};
|
|
2565
2726
|
let key;
|
|
2566
2727
|
let val;
|
|
2567
2728
|
let i;
|
|
2568
2729
|
|
|
2569
|
-
rawHeaders &&
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
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();
|
|
2573
2735
|
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2736
|
+
if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
|
|
2737
|
+
return;
|
|
2738
|
+
}
|
|
2577
2739
|
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2740
|
+
if (key === 'set-cookie') {
|
|
2741
|
+
if (parsed[key]) {
|
|
2742
|
+
parsed[key].push(val);
|
|
2743
|
+
} else {
|
|
2744
|
+
parsed[key] = [val];
|
|
2745
|
+
}
|
|
2581
2746
|
} else {
|
|
2582
|
-
parsed[key] = [val
|
|
2747
|
+
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
2583
2748
|
}
|
|
2584
|
-
}
|
|
2585
|
-
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
2586
|
-
}
|
|
2587
|
-
});
|
|
2749
|
+
});
|
|
2588
2750
|
|
|
2589
2751
|
return parsed;
|
|
2590
2752
|
};
|
|
2591
2753
|
|
|
2592
2754
|
const $internals = Symbol('internals');
|
|
2593
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
|
+
|
|
2594
2773
|
function normalizeHeader(header) {
|
|
2595
2774
|
return header && String(header).trim().toLowerCase();
|
|
2596
2775
|
}
|
|
2597
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
|
+
|
|
2598
2793
|
function normalizeValue(value) {
|
|
2599
2794
|
if (value === false || value == null) {
|
|
2600
2795
|
return value;
|
|
2601
2796
|
}
|
|
2602
2797
|
|
|
2603
|
-
return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
2798
|
+
return utils$1.isArray(value) ? value.map(normalizeValue) : stripTrailingCRLF(String(value));
|
|
2604
2799
|
}
|
|
2605
2800
|
|
|
2606
2801
|
function parseTokens(str) {
|
|
@@ -2638,8 +2833,10 @@ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
|
2638
2833
|
}
|
|
2639
2834
|
|
|
2640
2835
|
function formatHeader(header) {
|
|
2641
|
-
return header
|
|
2642
|
-
.
|
|
2836
|
+
return header
|
|
2837
|
+
.trim()
|
|
2838
|
+
.toLowerCase()
|
|
2839
|
+
.replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
|
2643
2840
|
return char.toUpperCase() + str;
|
|
2644
2841
|
});
|
|
2645
2842
|
}
|
|
@@ -2647,12 +2844,12 @@ function formatHeader(header) {
|
|
|
2647
2844
|
function buildAccessors(obj, header) {
|
|
2648
2845
|
const accessorName = utils$1.toCamelCase(' ' + header);
|
|
2649
2846
|
|
|
2650
|
-
['get', 'set', 'has'].forEach(methodName => {
|
|
2847
|
+
['get', 'set', 'has'].forEach((methodName) => {
|
|
2651
2848
|
Object.defineProperty(obj, methodName + accessorName, {
|
|
2652
|
-
value: function(arg1, arg2, arg3) {
|
|
2849
|
+
value: function (arg1, arg2, arg3) {
|
|
2653
2850
|
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
2654
2851
|
},
|
|
2655
|
-
configurable: true
|
|
2852
|
+
configurable: true,
|
|
2656
2853
|
});
|
|
2657
2854
|
});
|
|
2658
2855
|
}
|
|
@@ -2674,7 +2871,13 @@ class AxiosHeaders {
|
|
|
2674
2871
|
|
|
2675
2872
|
const key = utils$1.findKey(self, lHeader);
|
|
2676
2873
|
|
|
2677
|
-
if
|
|
2874
|
+
if (
|
|
2875
|
+
!key ||
|
|
2876
|
+
self[key] === undefined ||
|
|
2877
|
+
_rewrite === true ||
|
|
2878
|
+
(_rewrite === undefined && self[key] !== false)
|
|
2879
|
+
) {
|
|
2880
|
+
assertValidHeaderValue(_value, _header);
|
|
2678
2881
|
self[key || _header] = normalizeValue(_value);
|
|
2679
2882
|
}
|
|
2680
2883
|
}
|
|
@@ -2684,17 +2887,22 @@ class AxiosHeaders {
|
|
|
2684
2887
|
|
|
2685
2888
|
if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
|
|
2686
2889
|
setHeaders(header, valueOrRewrite);
|
|
2687
|
-
} else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
2890
|
+
} else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
2688
2891
|
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
2689
2892
|
} else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
|
|
2690
|
-
let obj = {},
|
|
2893
|
+
let obj = {},
|
|
2894
|
+
dest,
|
|
2895
|
+
key;
|
|
2691
2896
|
for (const entry of header) {
|
|
2692
2897
|
if (!utils$1.isArray(entry)) {
|
|
2693
2898
|
throw TypeError('Object iterator must return a key-value pair');
|
|
2694
2899
|
}
|
|
2695
2900
|
|
|
2696
|
-
obj[key = entry[0]] = (dest = obj[key])
|
|
2697
|
-
|
|
2901
|
+
obj[(key = entry[0])] = (dest = obj[key])
|
|
2902
|
+
? utils$1.isArray(dest)
|
|
2903
|
+
? [...dest, entry[1]]
|
|
2904
|
+
: [dest, entry[1]]
|
|
2905
|
+
: entry[1];
|
|
2698
2906
|
}
|
|
2699
2907
|
|
|
2700
2908
|
setHeaders(obj, valueOrRewrite);
|
|
@@ -2741,7 +2949,11 @@ class AxiosHeaders {
|
|
|
2741
2949
|
if (header) {
|
|
2742
2950
|
const key = utils$1.findKey(this, header);
|
|
2743
2951
|
|
|
2744
|
-
return !!(
|
|
2952
|
+
return !!(
|
|
2953
|
+
key &&
|
|
2954
|
+
this[key] !== undefined &&
|
|
2955
|
+
(!matcher || matchHeaderValue(this, this[key], key, matcher))
|
|
2956
|
+
);
|
|
2745
2957
|
}
|
|
2746
2958
|
|
|
2747
2959
|
return false;
|
|
@@ -2781,7 +2993,7 @@ class AxiosHeaders {
|
|
|
2781
2993
|
|
|
2782
2994
|
while (i--) {
|
|
2783
2995
|
const key = keys[i];
|
|
2784
|
-
if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
2996
|
+
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
2785
2997
|
delete this[key];
|
|
2786
2998
|
deleted = true;
|
|
2787
2999
|
}
|
|
@@ -2825,7 +3037,9 @@ class AxiosHeaders {
|
|
|
2825
3037
|
const obj = Object.create(null);
|
|
2826
3038
|
|
|
2827
3039
|
utils$1.forEach(this, (value, header) => {
|
|
2828
|
-
value != null &&
|
|
3040
|
+
value != null &&
|
|
3041
|
+
value !== false &&
|
|
3042
|
+
(obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
|
|
2829
3043
|
});
|
|
2830
3044
|
|
|
2831
3045
|
return obj;
|
|
@@ -2836,11 +3050,13 @@ class AxiosHeaders {
|
|
|
2836
3050
|
}
|
|
2837
3051
|
|
|
2838
3052
|
toString() {
|
|
2839
|
-
return Object.entries(this.toJSON())
|
|
3053
|
+
return Object.entries(this.toJSON())
|
|
3054
|
+
.map(([header, value]) => header + ': ' + value)
|
|
3055
|
+
.join('\n');
|
|
2840
3056
|
}
|
|
2841
3057
|
|
|
2842
3058
|
getSetCookie() {
|
|
2843
|
-
return this.get(
|
|
3059
|
+
return this.get('set-cookie') || [];
|
|
2844
3060
|
}
|
|
2845
3061
|
|
|
2846
3062
|
get [Symbol.toStringTag]() {
|
|
@@ -2860,9 +3076,12 @@ class AxiosHeaders {
|
|
|
2860
3076
|
}
|
|
2861
3077
|
|
|
2862
3078
|
static accessor(header) {
|
|
2863
|
-
const internals =
|
|
2864
|
-
|
|
2865
|
-
|
|
3079
|
+
const internals =
|
|
3080
|
+
(this[$internals] =
|
|
3081
|
+
this[$internals] =
|
|
3082
|
+
{
|
|
3083
|
+
accessors: {},
|
|
3084
|
+
});
|
|
2866
3085
|
|
|
2867
3086
|
const accessors = internals.accessors;
|
|
2868
3087
|
const prototype = this.prototype;
|
|
@@ -2882,23 +3101,28 @@ class AxiosHeaders {
|
|
|
2882
3101
|
}
|
|
2883
3102
|
}
|
|
2884
3103
|
|
|
2885
|
-
AxiosHeaders.accessor([
|
|
3104
|
+
AxiosHeaders.accessor([
|
|
3105
|
+
'Content-Type',
|
|
3106
|
+
'Content-Length',
|
|
3107
|
+
'Accept',
|
|
3108
|
+
'Accept-Encoding',
|
|
3109
|
+
'User-Agent',
|
|
3110
|
+
'Authorization',
|
|
3111
|
+
]);
|
|
2886
3112
|
|
|
2887
3113
|
// reserved names hotfix
|
|
2888
|
-
utils$1.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
|
|
3114
|
+
utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
|
|
2889
3115
|
let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
|
|
2890
3116
|
return {
|
|
2891
3117
|
get: () => value,
|
|
2892
3118
|
set(headerValue) {
|
|
2893
3119
|
this[mapped] = headerValue;
|
|
2894
|
-
}
|
|
2895
|
-
}
|
|
3120
|
+
},
|
|
3121
|
+
};
|
|
2896
3122
|
});
|
|
2897
3123
|
|
|
2898
3124
|
utils$1.freezeMethods(AxiosHeaders);
|
|
2899
3125
|
|
|
2900
|
-
var AxiosHeaders$1 = AxiosHeaders;
|
|
2901
|
-
|
|
2902
3126
|
/**
|
|
2903
3127
|
* Transform the data for a request or a response
|
|
2904
3128
|
*
|
|
@@ -2908,9 +3132,9 @@ var AxiosHeaders$1 = AxiosHeaders;
|
|
|
2908
3132
|
* @returns {*} The resulting transformed data
|
|
2909
3133
|
*/
|
|
2910
3134
|
function transformData(fns, response) {
|
|
2911
|
-
const config = this || defaults
|
|
3135
|
+
const config = this || defaults;
|
|
2912
3136
|
const context = response || config;
|
|
2913
|
-
const headers = AxiosHeaders
|
|
3137
|
+
const headers = AxiosHeaders.from(context.headers);
|
|
2914
3138
|
let data = context.data;
|
|
2915
3139
|
|
|
2916
3140
|
utils$1.forEach(fns, function transform(fn) {
|
|
@@ -2926,25 +3150,23 @@ function isCancel(value) {
|
|
|
2926
3150
|
return !!(value && value.__CANCEL__);
|
|
2927
3151
|
}
|
|
2928
3152
|
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
3153
|
+
class CanceledError extends AxiosError {
|
|
3154
|
+
/**
|
|
3155
|
+
* A `CanceledError` is an object that is thrown when an operation is canceled.
|
|
3156
|
+
*
|
|
3157
|
+
* @param {string=} message The message.
|
|
3158
|
+
* @param {Object=} config The config.
|
|
3159
|
+
* @param {Object=} request The request.
|
|
3160
|
+
*
|
|
3161
|
+
* @returns {CanceledError} The created error.
|
|
3162
|
+
*/
|
|
3163
|
+
constructor(message, config, request) {
|
|
3164
|
+
super(message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
|
|
3165
|
+
this.name = 'CanceledError';
|
|
3166
|
+
this.__CANCEL__ = true;
|
|
3167
|
+
}
|
|
2942
3168
|
}
|
|
2943
3169
|
|
|
2944
|
-
utils$1.inherits(CanceledError, AxiosError, {
|
|
2945
|
-
__CANCEL__: true
|
|
2946
|
-
});
|
|
2947
|
-
|
|
2948
3170
|
/**
|
|
2949
3171
|
* Resolve or reject a Promise based on response status.
|
|
2950
3172
|
*
|
|
@@ -2959,19 +3181,23 @@ function settle(resolve, reject, response) {
|
|
|
2959
3181
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
2960
3182
|
resolve(response);
|
|
2961
3183
|
} else {
|
|
2962
|
-
reject(
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
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
|
+
);
|
|
2969
3195
|
}
|
|
2970
3196
|
}
|
|
2971
3197
|
|
|
2972
3198
|
function parseProtocol(url) {
|
|
2973
3199
|
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
2974
|
-
return match && match[1] || '';
|
|
3200
|
+
return (match && match[1]) || '';
|
|
2975
3201
|
}
|
|
2976
3202
|
|
|
2977
3203
|
/**
|
|
@@ -3022,7 +3248,7 @@ function speedometer(samplesCount, min) {
|
|
|
3022
3248
|
|
|
3023
3249
|
const passed = startedAt && now - startedAt;
|
|
3024
3250
|
|
|
3025
|
-
return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
|
|
3251
|
+
return passed ? Math.round((bytesCount * 1000) / passed) : undefined;
|
|
3026
3252
|
};
|
|
3027
3253
|
}
|
|
3028
3254
|
|
|
@@ -3051,7 +3277,7 @@ function throttle(fn, freq) {
|
|
|
3051
3277
|
const throttled = (...args) => {
|
|
3052
3278
|
const now = Date.now();
|
|
3053
3279
|
const passed = now - timestamp;
|
|
3054
|
-
if (
|
|
3280
|
+
if (passed >= threshold) {
|
|
3055
3281
|
invoke(args, now);
|
|
3056
3282
|
} else {
|
|
3057
3283
|
lastArgs = args;
|
|
@@ -3073,7 +3299,7 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
|
3073
3299
|
let bytesNotified = 0;
|
|
3074
3300
|
const _speedometer = speedometer(50, 250);
|
|
3075
3301
|
|
|
3076
|
-
return throttle(e => {
|
|
3302
|
+
return throttle((e) => {
|
|
3077
3303
|
const loaded = e.loaded;
|
|
3078
3304
|
const total = e.lengthComputable ? e.total : undefined;
|
|
3079
3305
|
const progressBytes = loaded - bytesNotified;
|
|
@@ -3085,13 +3311,13 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
|
3085
3311
|
const data = {
|
|
3086
3312
|
loaded,
|
|
3087
3313
|
total,
|
|
3088
|
-
progress: total ?
|
|
3314
|
+
progress: total ? loaded / total : undefined,
|
|
3089
3315
|
bytes: progressBytes,
|
|
3090
3316
|
rate: rate ? rate : undefined,
|
|
3091
3317
|
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
|
3092
3318
|
event: e,
|
|
3093
3319
|
lengthComputable: total != null,
|
|
3094
|
-
[isDownloadStream ? 'download' : 'upload']: true
|
|
3320
|
+
[isDownloadStream ? 'download' : 'upload']: true,
|
|
3095
3321
|
};
|
|
3096
3322
|
|
|
3097
3323
|
listener(data);
|
|
@@ -3101,77 +3327,82 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
|
3101
3327
|
const progressEventDecorator = (total, throttled) => {
|
|
3102
3328
|
const lengthComputable = total != null;
|
|
3103
3329
|
|
|
3104
|
-
return [
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3330
|
+
return [
|
|
3331
|
+
(loaded) =>
|
|
3332
|
+
throttled[0]({
|
|
3333
|
+
lengthComputable,
|
|
3334
|
+
total,
|
|
3335
|
+
loaded,
|
|
3336
|
+
}),
|
|
3337
|
+
throttled[1],
|
|
3338
|
+
];
|
|
3109
3339
|
};
|
|
3110
3340
|
|
|
3111
|
-
const asyncDecorator =
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3341
|
+
const asyncDecorator =
|
|
3342
|
+
(fn) =>
|
|
3343
|
+
(...args) =>
|
|
3344
|
+
utils$1.asap(() => fn(...args));
|
|
3115
3345
|
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
(isMSIE || origin.port === url.port)
|
|
3120
|
-
);
|
|
3121
|
-
})(
|
|
3122
|
-
new URL(platform.origin),
|
|
3123
|
-
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
|
3124
|
-
) : () => true;
|
|
3346
|
+
var isURLSameOrigin = platform.hasStandardBrowserEnv
|
|
3347
|
+
? ((origin, isMSIE) => (url) => {
|
|
3348
|
+
url = new URL(url, platform.origin);
|
|
3125
3349
|
|
|
3126
|
-
|
|
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;
|
|
3127
3360
|
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
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;
|
|
3132
3366
|
|
|
3133
|
-
|
|
3367
|
+
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
3134
3368
|
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
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
|
+
}
|
|
3150
3384
|
|
|
3151
|
-
|
|
3152
|
-
|
|
3385
|
+
document.cookie = cookie.join('; ');
|
|
3386
|
+
},
|
|
3153
3387
|
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
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
|
+
},
|
|
3159
3393
|
|
|
3160
|
-
|
|
3161
|
-
|
|
3394
|
+
remove(name) {
|
|
3395
|
+
this.write(name, '', Date.now() - 86400000, '/');
|
|
3396
|
+
},
|
|
3162
3397
|
}
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
return null;
|
|
3172
|
-
},
|
|
3173
|
-
remove() {}
|
|
3174
|
-
};
|
|
3398
|
+
: // Non-standard browser env (web workers, react-native) lack needed support.
|
|
3399
|
+
{
|
|
3400
|
+
write() {},
|
|
3401
|
+
read() {
|
|
3402
|
+
return null;
|
|
3403
|
+
},
|
|
3404
|
+
remove() {},
|
|
3405
|
+
};
|
|
3175
3406
|
|
|
3176
3407
|
/**
|
|
3177
3408
|
* Determines whether the specified URL is absolute
|
|
@@ -3184,6 +3415,10 @@ function isAbsoluteURL(url) {
|
|
|
3184
3415
|
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
|
3185
3416
|
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
|
3186
3417
|
// by any combination of letters, digits, plus, period, or hyphen.
|
|
3418
|
+
if (typeof url !== 'string') {
|
|
3419
|
+
return false;
|
|
3420
|
+
}
|
|
3421
|
+
|
|
3187
3422
|
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
3188
3423
|
}
|
|
3189
3424
|
|
|
@@ -3219,7 +3454,7 @@ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
|
3219
3454
|
return requestedURL;
|
|
3220
3455
|
}
|
|
3221
3456
|
|
|
3222
|
-
const headersToObject = (thing) => thing instanceof AxiosHeaders
|
|
3457
|
+
const headersToObject = (thing) => (thing instanceof AxiosHeaders ? { ...thing } : thing);
|
|
3223
3458
|
|
|
3224
3459
|
/**
|
|
3225
3460
|
* Config-specific merge-function which creates a new config-object
|
|
@@ -3237,7 +3472,7 @@ function mergeConfig(config1, config2) {
|
|
|
3237
3472
|
|
|
3238
3473
|
function getMergedValue(target, source, prop, caseless) {
|
|
3239
3474
|
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
3240
|
-
return utils$1.merge.call({caseless}, target, source);
|
|
3475
|
+
return utils$1.merge.call({ caseless }, target, source);
|
|
3241
3476
|
} else if (utils$1.isPlainObject(source)) {
|
|
3242
3477
|
return utils$1.merge({}, source);
|
|
3243
3478
|
} else if (utils$1.isArray(source)) {
|
|
@@ -3246,7 +3481,6 @@ function mergeConfig(config1, config2) {
|
|
|
3246
3481
|
return source;
|
|
3247
3482
|
}
|
|
3248
3483
|
|
|
3249
|
-
// eslint-disable-next-line consistent-return
|
|
3250
3484
|
function mergeDeepProperties(a, b, prop, caseless) {
|
|
3251
3485
|
if (!utils$1.isUndefined(b)) {
|
|
3252
3486
|
return getMergedValue(a, b, prop, caseless);
|
|
@@ -3309,11 +3543,13 @@ function mergeConfig(config1, config2) {
|
|
|
3309
3543
|
socketPath: defaultToConfig2,
|
|
3310
3544
|
responseEncoding: defaultToConfig2,
|
|
3311
3545
|
validateStatus: mergeDirectKeys,
|
|
3312
|
-
headers: (a, b, prop) =>
|
|
3546
|
+
headers: (a, b, prop) =>
|
|
3547
|
+
mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true),
|
|
3313
3548
|
};
|
|
3314
3549
|
|
|
3315
|
-
utils$1.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
|
|
3316
|
-
|
|
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;
|
|
3317
3553
|
const configValue = merge(config1[prop], config2[prop], prop);
|
|
3318
3554
|
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
3319
3555
|
});
|
|
@@ -3326,14 +3562,24 @@ var resolveConfig = (config) => {
|
|
|
3326
3562
|
|
|
3327
3563
|
let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
|
|
3328
3564
|
|
|
3329
|
-
newConfig.headers = headers = AxiosHeaders
|
|
3565
|
+
newConfig.headers = headers = AxiosHeaders.from(headers);
|
|
3330
3566
|
|
|
3331
|
-
newConfig.url = buildURL(
|
|
3567
|
+
newConfig.url = buildURL(
|
|
3568
|
+
buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls),
|
|
3569
|
+
config.params,
|
|
3570
|
+
config.paramsSerializer
|
|
3571
|
+
);
|
|
3332
3572
|
|
|
3333
3573
|
// HTTP basic authentication
|
|
3334
3574
|
if (auth) {
|
|
3335
|
-
headers.set(
|
|
3336
|
-
|
|
3575
|
+
headers.set(
|
|
3576
|
+
'Authorization',
|
|
3577
|
+
'Basic ' +
|
|
3578
|
+
btoa(
|
|
3579
|
+
(auth.username || '') +
|
|
3580
|
+
':' +
|
|
3581
|
+
(auth.password ? unescape(encodeURIComponent(auth.password)) : '')
|
|
3582
|
+
)
|
|
3337
3583
|
);
|
|
3338
3584
|
}
|
|
3339
3585
|
|
|
@@ -3351,7 +3597,7 @@ var resolveConfig = (config) => {
|
|
|
3351
3597
|
}
|
|
3352
3598
|
});
|
|
3353
3599
|
}
|
|
3354
|
-
}
|
|
3600
|
+
}
|
|
3355
3601
|
|
|
3356
3602
|
// Add xsrf header
|
|
3357
3603
|
// This is only done if running in a standard browser environment.
|
|
@@ -3375,196 +3621,218 @@ var resolveConfig = (config) => {
|
|
|
3375
3621
|
|
|
3376
3622
|
const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
|
3377
3623
|
|
|
3378
|
-
var xhrAdapter = isXHRAdapterSupported &&
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
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;
|
|
3387
3634
|
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3635
|
+
function done() {
|
|
3636
|
+
flushUpload && flushUpload(); // flush events
|
|
3637
|
+
flushDownload && flushDownload(); // flush events
|
|
3391
3638
|
|
|
3392
|
-
|
|
3639
|
+
_config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
|
|
3393
3640
|
|
|
3394
|
-
|
|
3395
|
-
|
|
3641
|
+
_config.signal && _config.signal.removeEventListener('abort', onCanceled);
|
|
3642
|
+
}
|
|
3396
3643
|
|
|
3397
|
-
|
|
3644
|
+
let request = new XMLHttpRequest();
|
|
3398
3645
|
|
|
3399
|
-
|
|
3646
|
+
request.open(_config.method.toUpperCase(), _config.url, true);
|
|
3400
3647
|
|
|
3401
|
-
|
|
3402
|
-
|
|
3648
|
+
// Set the request timeout in MS
|
|
3649
|
+
request.timeout = _config.timeout;
|
|
3403
3650
|
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
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;
|
|
3407
3686
|
}
|
|
3408
|
-
// Prepare the response
|
|
3409
|
-
const responseHeaders = AxiosHeaders$1.from(
|
|
3410
|
-
'getAllResponseHeaders' in request && request.getAllResponseHeaders()
|
|
3411
|
-
);
|
|
3412
|
-
const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
|
|
3413
|
-
request.responseText : request.response;
|
|
3414
|
-
const response = {
|
|
3415
|
-
data: responseData,
|
|
3416
|
-
status: request.status,
|
|
3417
|
-
statusText: request.statusText,
|
|
3418
|
-
headers: responseHeaders,
|
|
3419
|
-
config,
|
|
3420
|
-
request
|
|
3421
|
-
};
|
|
3422
3687
|
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
}
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
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
|
+
}
|
|
3430
3697
|
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
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
|
+
}
|
|
3434
3713
|
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
} else {
|
|
3439
|
-
// Listen for ready state to emulate onloadend
|
|
3440
|
-
request.onreadystatechange = function handleLoad() {
|
|
3441
|
-
if (!request || request.readyState !== 4) {
|
|
3714
|
+
// Handle browser request cancellation (as opposed to a manual cancellation)
|
|
3715
|
+
request.onabort = function handleAbort() {
|
|
3716
|
+
if (!request) {
|
|
3442
3717
|
return;
|
|
3443
3718
|
}
|
|
3444
3719
|
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
//
|
|
3448
|
-
|
|
3449
|
-
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
|
|
3450
|
-
return;
|
|
3451
|
-
}
|
|
3452
|
-
// readystate handler is calling before onerror or ontimeout handlers,
|
|
3453
|
-
// so we should call onloadend on the next 'tick'
|
|
3454
|
-
setTimeout(onloadend);
|
|
3720
|
+
reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
|
|
3721
|
+
|
|
3722
|
+
// Clean up request
|
|
3723
|
+
request = null;
|
|
3455
3724
|
};
|
|
3456
|
-
}
|
|
3457
3725
|
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
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
|
+
};
|
|
3463
3738
|
|
|
3464
|
-
|
|
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
|
+
);
|
|
3465
3756
|
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3757
|
+
// Clean up request
|
|
3758
|
+
request = null;
|
|
3759
|
+
};
|
|
3469
3760
|
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
// Browsers deliver a ProgressEvent in XHR onerror
|
|
3473
|
-
// (message may be empty; when present, surface it)
|
|
3474
|
-
// See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
|
|
3475
|
-
const msg = event && event.message ? event.message : 'Network Error';
|
|
3476
|
-
const err = new AxiosError(msg, AxiosError.ERR_NETWORK, config, request);
|
|
3477
|
-
// attach the underlying event for consumers who want details
|
|
3478
|
-
err.event = event || null;
|
|
3479
|
-
reject(err);
|
|
3480
|
-
request = null;
|
|
3481
|
-
};
|
|
3482
|
-
|
|
3483
|
-
// Handle timeout
|
|
3484
|
-
request.ontimeout = function handleTimeout() {
|
|
3485
|
-
let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
|
|
3486
|
-
const transitional = _config.transitional || transitionalDefaults;
|
|
3487
|
-
if (_config.timeoutErrorMessage) {
|
|
3488
|
-
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
3489
|
-
}
|
|
3490
|
-
reject(new AxiosError(
|
|
3491
|
-
timeoutErrorMessage,
|
|
3492
|
-
transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
|
|
3493
|
-
config,
|
|
3494
|
-
request));
|
|
3495
|
-
|
|
3496
|
-
// Clean up request
|
|
3497
|
-
request = null;
|
|
3498
|
-
};
|
|
3761
|
+
// Remove Content-Type if data is undefined
|
|
3762
|
+
requestData === undefined && requestHeaders.setContentType(null);
|
|
3499
3763
|
|
|
3500
|
-
|
|
3501
|
-
|
|
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
|
+
}
|
|
3502
3770
|
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
});
|
|
3508
|
-
}
|
|
3771
|
+
// Add withCredentials to request if needed
|
|
3772
|
+
if (!utils$1.isUndefined(_config.withCredentials)) {
|
|
3773
|
+
request.withCredentials = !!_config.withCredentials;
|
|
3774
|
+
}
|
|
3509
3775
|
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3776
|
+
// Add responseType to request if needed
|
|
3777
|
+
if (responseType && responseType !== 'json') {
|
|
3778
|
+
request.responseType = _config.responseType;
|
|
3779
|
+
}
|
|
3514
3780
|
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3781
|
+
// Handle progress if needed
|
|
3782
|
+
if (onDownloadProgress) {
|
|
3783
|
+
[downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
|
|
3784
|
+
request.addEventListener('progress', downloadThrottled);
|
|
3785
|
+
}
|
|
3519
3786
|
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
request.addEventListener('progress', downloadThrottled);
|
|
3524
|
-
}
|
|
3787
|
+
// Not all browsers support upload events
|
|
3788
|
+
if (onUploadProgress && request.upload) {
|
|
3789
|
+
[uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
|
|
3525
3790
|
|
|
3526
|
-
|
|
3527
|
-
if (onUploadProgress && request.upload) {
|
|
3528
|
-
([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress));
|
|
3791
|
+
request.upload.addEventListener('progress', uploadThrottled);
|
|
3529
3792
|
|
|
3530
|
-
|
|
3793
|
+
request.upload.addEventListener('loadend', flushUpload);
|
|
3794
|
+
}
|
|
3531
3795
|
|
|
3532
|
-
|
|
3533
|
-
|
|
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
|
+
};
|
|
3534
3807
|
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
return;
|
|
3808
|
+
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
|
3809
|
+
if (_config.signal) {
|
|
3810
|
+
_config.signal.aborted
|
|
3811
|
+
? onCanceled()
|
|
3812
|
+
: _config.signal.addEventListener('abort', onCanceled);
|
|
3541
3813
|
}
|
|
3542
|
-
reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
|
|
3543
|
-
request.abort();
|
|
3544
|
-
request = null;
|
|
3545
|
-
};
|
|
3546
|
-
|
|
3547
|
-
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
|
3548
|
-
if (_config.signal) {
|
|
3549
|
-
_config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
|
|
3550
3814
|
}
|
|
3551
|
-
}
|
|
3552
3815
|
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
3556
|
-
reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
|
|
3557
|
-
return;
|
|
3558
|
-
}
|
|
3816
|
+
const protocol = parseProtocol(_config.url);
|
|
3559
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
|
+
}
|
|
3560
3828
|
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
};
|
|
3829
|
+
// Send the request
|
|
3830
|
+
request.send(requestData || null);
|
|
3831
|
+
});
|
|
3832
|
+
};
|
|
3565
3833
|
|
|
3566
3834
|
const composeSignals = (signals, timeout) => {
|
|
3567
|
-
const {length} = (signals = signals ? signals.filter(Boolean) : []);
|
|
3835
|
+
const { length } = (signals = signals ? signals.filter(Boolean) : []);
|
|
3568
3836
|
|
|
3569
3837
|
if (timeout || length) {
|
|
3570
3838
|
let controller = new AbortController();
|
|
@@ -3576,21 +3844,29 @@ const composeSignals = (signals, timeout) => {
|
|
|
3576
3844
|
aborted = true;
|
|
3577
3845
|
unsubscribe();
|
|
3578
3846
|
const err = reason instanceof Error ? reason : this.reason;
|
|
3579
|
-
controller.abort(
|
|
3847
|
+
controller.abort(
|
|
3848
|
+
err instanceof AxiosError
|
|
3849
|
+
? err
|
|
3850
|
+
: new CanceledError(err instanceof Error ? err.message : err)
|
|
3851
|
+
);
|
|
3580
3852
|
}
|
|
3581
3853
|
};
|
|
3582
3854
|
|
|
3583
|
-
let timer =
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3855
|
+
let timer =
|
|
3856
|
+
timeout &&
|
|
3857
|
+
setTimeout(() => {
|
|
3858
|
+
timer = null;
|
|
3859
|
+
onabort(new AxiosError(`timeout of ${timeout}ms exceeded`, AxiosError.ETIMEDOUT));
|
|
3860
|
+
}, timeout);
|
|
3587
3861
|
|
|
3588
3862
|
const unsubscribe = () => {
|
|
3589
3863
|
if (signals) {
|
|
3590
3864
|
timer && clearTimeout(timer);
|
|
3591
3865
|
timer = null;
|
|
3592
|
-
signals.forEach(signal => {
|
|
3593
|
-
signal.unsubscribe
|
|
3866
|
+
signals.forEach((signal) => {
|
|
3867
|
+
signal.unsubscribe
|
|
3868
|
+
? signal.unsubscribe(onabort)
|
|
3869
|
+
: signal.removeEventListener('abort', onabort);
|
|
3594
3870
|
});
|
|
3595
3871
|
signals = null;
|
|
3596
3872
|
}
|
|
@@ -3598,7 +3874,7 @@ const composeSignals = (signals, timeout) => {
|
|
|
3598
3874
|
|
|
3599
3875
|
signals.forEach((signal) => signal.addEventListener('abort', onabort));
|
|
3600
3876
|
|
|
3601
|
-
const {signal} = controller;
|
|
3877
|
+
const { signal } = controller;
|
|
3602
3878
|
|
|
3603
3879
|
signal.unsubscribe = () => utils$1.asap(unsubscribe);
|
|
3604
3880
|
|
|
@@ -3606,12 +3882,10 @@ const composeSignals = (signals, timeout) => {
|
|
|
3606
3882
|
}
|
|
3607
3883
|
};
|
|
3608
3884
|
|
|
3609
|
-
var composeSignals$1 = composeSignals;
|
|
3610
|
-
|
|
3611
3885
|
const streamChunk = function* (chunk, chunkSize) {
|
|
3612
3886
|
let len = chunk.byteLength;
|
|
3613
3887
|
|
|
3614
|
-
if (
|
|
3888
|
+
if (len < chunkSize) {
|
|
3615
3889
|
yield chunk;
|
|
3616
3890
|
return;
|
|
3617
3891
|
}
|
|
@@ -3641,7 +3915,7 @@ const readStream = async function* (stream) {
|
|
|
3641
3915
|
const reader = stream.getReader();
|
|
3642
3916
|
try {
|
|
3643
3917
|
for (;;) {
|
|
3644
|
-
const {done, value} = await reader.read();
|
|
3918
|
+
const { done, value } = await reader.read();
|
|
3645
3919
|
if (done) {
|
|
3646
3920
|
break;
|
|
3647
3921
|
}
|
|
@@ -3664,64 +3938,69 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
|
3664
3938
|
}
|
|
3665
3939
|
};
|
|
3666
3940
|
|
|
3667
|
-
return new ReadableStream(
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3941
|
+
return new ReadableStream(
|
|
3942
|
+
{
|
|
3943
|
+
async pull(controller) {
|
|
3944
|
+
try {
|
|
3945
|
+
const { done, value } = await iterator.next();
|
|
3671
3946
|
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3947
|
+
if (done) {
|
|
3948
|
+
_onFinish();
|
|
3949
|
+
controller.close();
|
|
3950
|
+
return;
|
|
3951
|
+
}
|
|
3677
3952
|
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
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;
|
|
3682
3962
|
}
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
_onFinish(
|
|
3686
|
-
|
|
3687
|
-
}
|
|
3963
|
+
},
|
|
3964
|
+
cancel(reason) {
|
|
3965
|
+
_onFinish(reason);
|
|
3966
|
+
return iterator.return();
|
|
3967
|
+
},
|
|
3688
3968
|
},
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
return iterator.return();
|
|
3969
|
+
{
|
|
3970
|
+
highWaterMark: 2,
|
|
3692
3971
|
}
|
|
3693
|
-
|
|
3694
|
-
highWaterMark: 2
|
|
3695
|
-
})
|
|
3972
|
+
);
|
|
3696
3973
|
};
|
|
3697
3974
|
|
|
3698
3975
|
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
3699
3976
|
|
|
3700
|
-
const {isFunction} = utils$1;
|
|
3977
|
+
const { isFunction } = utils$1;
|
|
3701
3978
|
|
|
3702
|
-
const globalFetchAPI = (({Request, Response}) => ({
|
|
3703
|
-
Request,
|
|
3979
|
+
const globalFetchAPI = (({ Request, Response }) => ({
|
|
3980
|
+
Request,
|
|
3981
|
+
Response,
|
|
3704
3982
|
}))(utils$1.global);
|
|
3705
3983
|
|
|
3706
|
-
const {
|
|
3707
|
-
ReadableStream: ReadableStream$1, TextEncoder
|
|
3708
|
-
} = utils$1.global;
|
|
3709
|
-
|
|
3984
|
+
const { ReadableStream: ReadableStream$1, TextEncoder } = utils$1.global;
|
|
3710
3985
|
|
|
3711
3986
|
const test = (fn, ...args) => {
|
|
3712
3987
|
try {
|
|
3713
3988
|
return !!fn(...args);
|
|
3714
3989
|
} catch (e) {
|
|
3715
|
-
return false
|
|
3990
|
+
return false;
|
|
3716
3991
|
}
|
|
3717
3992
|
};
|
|
3718
3993
|
|
|
3719
3994
|
const factory = (env) => {
|
|
3720
|
-
env = utils$1.merge.call(
|
|
3721
|
-
|
|
3722
|
-
|
|
3995
|
+
env = utils$1.merge.call(
|
|
3996
|
+
{
|
|
3997
|
+
skipUndefined: true,
|
|
3998
|
+
},
|
|
3999
|
+
globalFetchAPI,
|
|
4000
|
+
env
|
|
4001
|
+
);
|
|
3723
4002
|
|
|
3724
|
-
const {fetch: envFetch, Request, Response} = env;
|
|
4003
|
+
const { fetch: envFetch, Request, Response } = env;
|
|
3725
4004
|
const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
|
|
3726
4005
|
const isRequestSupported = isFunction(Request);
|
|
3727
4006
|
const isResponseSupported = isFunction(Response);
|
|
@@ -3732,46 +4011,65 @@ const factory = (env) => {
|
|
|
3732
4011
|
|
|
3733
4012
|
const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
|
|
3734
4013
|
|
|
3735
|
-
const encodeText =
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
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()));
|
|
3739
4022
|
|
|
3740
|
-
const supportsRequestStream =
|
|
3741
|
-
|
|
4023
|
+
const supportsRequestStream =
|
|
4024
|
+
isRequestSupported &&
|
|
4025
|
+
isReadableStreamSupported &&
|
|
4026
|
+
test(() => {
|
|
4027
|
+
let duplexAccessed = false;
|
|
3742
4028
|
|
|
3743
|
-
|
|
3744
|
-
body: new ReadableStream$1(),
|
|
3745
|
-
method: 'POST',
|
|
3746
|
-
get duplex() {
|
|
3747
|
-
duplexAccessed = true;
|
|
3748
|
-
return 'half';
|
|
3749
|
-
},
|
|
3750
|
-
}).headers.has('Content-Type');
|
|
4029
|
+
const body = new ReadableStream$1();
|
|
3751
4030
|
|
|
3752
|
-
|
|
3753
|
-
|
|
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
|
+
});
|
|
3754
4044
|
|
|
3755
|
-
const supportsResponseStream =
|
|
4045
|
+
const supportsResponseStream =
|
|
4046
|
+
isResponseSupported &&
|
|
4047
|
+
isReadableStreamSupported &&
|
|
3756
4048
|
test(() => utils$1.isReadableStream(new Response('').body));
|
|
3757
4049
|
|
|
3758
4050
|
const resolvers = {
|
|
3759
|
-
stream: supportsResponseStream && ((res) => res.body)
|
|
4051
|
+
stream: supportsResponseStream && ((res) => res.body),
|
|
3760
4052
|
};
|
|
3761
4053
|
|
|
3762
|
-
isFetchSupported &&
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
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];
|
|
3766
4060
|
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
4061
|
+
if (method) {
|
|
4062
|
+
return method.call(res);
|
|
4063
|
+
}
|
|
3770
4064
|
|
|
3771
|
-
|
|
4065
|
+
throw new AxiosError(
|
|
4066
|
+
`Response type '${type}' is not supported`,
|
|
4067
|
+
AxiosError.ERR_NOT_SUPPORT,
|
|
4068
|
+
config
|
|
4069
|
+
);
|
|
4070
|
+
});
|
|
3772
4071
|
});
|
|
3773
|
-
});
|
|
3774
|
-
})());
|
|
4072
|
+
})();
|
|
3775
4073
|
|
|
3776
4074
|
const getBodyLength = async (body) => {
|
|
3777
4075
|
if (body == null) {
|
|
@@ -3822,32 +4120,41 @@ const factory = (env) => {
|
|
|
3822
4120
|
responseType,
|
|
3823
4121
|
headers,
|
|
3824
4122
|
withCredentials = 'same-origin',
|
|
3825
|
-
fetchOptions
|
|
4123
|
+
fetchOptions,
|
|
3826
4124
|
} = resolveConfig(config);
|
|
3827
4125
|
|
|
3828
4126
|
let _fetch = envFetch || fetch;
|
|
3829
4127
|
|
|
3830
4128
|
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
3831
4129
|
|
|
3832
|
-
let composedSignal = composeSignals
|
|
4130
|
+
let composedSignal = composeSignals(
|
|
4131
|
+
[signal, cancelToken && cancelToken.toAbortSignal()],
|
|
4132
|
+
timeout
|
|
4133
|
+
);
|
|
3833
4134
|
|
|
3834
4135
|
let request = null;
|
|
3835
4136
|
|
|
3836
|
-
const unsubscribe =
|
|
3837
|
-
composedSignal
|
|
3838
|
-
|
|
4137
|
+
const unsubscribe =
|
|
4138
|
+
composedSignal &&
|
|
4139
|
+
composedSignal.unsubscribe &&
|
|
4140
|
+
(() => {
|
|
4141
|
+
composedSignal.unsubscribe();
|
|
4142
|
+
});
|
|
3839
4143
|
|
|
3840
4144
|
let requestContentLength;
|
|
3841
4145
|
|
|
3842
4146
|
try {
|
|
3843
4147
|
if (
|
|
3844
|
-
onUploadProgress &&
|
|
4148
|
+
onUploadProgress &&
|
|
4149
|
+
supportsRequestStream &&
|
|
4150
|
+
method !== 'get' &&
|
|
4151
|
+
method !== 'head' &&
|
|
3845
4152
|
(requestContentLength = await resolveBodyLength(headers, data)) !== 0
|
|
3846
4153
|
) {
|
|
3847
4154
|
let _request = new Request(url, {
|
|
3848
4155
|
method: 'POST',
|
|
3849
4156
|
body: data,
|
|
3850
|
-
duplex:
|
|
4157
|
+
duplex: 'half',
|
|
3851
4158
|
});
|
|
3852
4159
|
|
|
3853
4160
|
let contentTypeHeader;
|
|
@@ -3872,7 +4179,7 @@ const factory = (env) => {
|
|
|
3872
4179
|
|
|
3873
4180
|
// Cloudflare Workers throws when credentials are defined
|
|
3874
4181
|
// see https://github.com/cloudflare/workerd/issues/902
|
|
3875
|
-
const isCredentialsSupported = isRequestSupported &&
|
|
4182
|
+
const isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype;
|
|
3876
4183
|
|
|
3877
4184
|
const resolvedOptions = {
|
|
3878
4185
|
...fetchOptions,
|
|
@@ -3880,29 +4187,35 @@ const factory = (env) => {
|
|
|
3880
4187
|
method: method.toUpperCase(),
|
|
3881
4188
|
headers: headers.normalize().toJSON(),
|
|
3882
4189
|
body: data,
|
|
3883
|
-
duplex:
|
|
3884
|
-
credentials: isCredentialsSupported ? withCredentials : undefined
|
|
4190
|
+
duplex: 'half',
|
|
4191
|
+
credentials: isCredentialsSupported ? withCredentials : undefined,
|
|
3885
4192
|
};
|
|
3886
4193
|
|
|
3887
4194
|
request = isRequestSupported && new Request(url, resolvedOptions);
|
|
3888
4195
|
|
|
3889
|
-
let response = await (isRequestSupported
|
|
4196
|
+
let response = await (isRequestSupported
|
|
4197
|
+
? _fetch(request, fetchOptions)
|
|
4198
|
+
: _fetch(url, resolvedOptions));
|
|
3890
4199
|
|
|
3891
|
-
const isStreamResponse =
|
|
4200
|
+
const isStreamResponse =
|
|
4201
|
+
supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
3892
4202
|
|
|
3893
4203
|
if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
|
|
3894
4204
|
const options = {};
|
|
3895
4205
|
|
|
3896
|
-
['status', 'statusText', 'headers'].forEach(prop => {
|
|
4206
|
+
['status', 'statusText', 'headers'].forEach((prop) => {
|
|
3897
4207
|
options[prop] = response[prop];
|
|
3898
4208
|
});
|
|
3899
4209
|
|
|
3900
4210
|
const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
|
|
3901
4211
|
|
|
3902
|
-
const [onProgress, flush] =
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
4212
|
+
const [onProgress, flush] =
|
|
4213
|
+
(onDownloadProgress &&
|
|
4214
|
+
progressEventDecorator(
|
|
4215
|
+
responseContentLength,
|
|
4216
|
+
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
4217
|
+
)) ||
|
|
4218
|
+
[];
|
|
3906
4219
|
|
|
3907
4220
|
response = new Response(
|
|
3908
4221
|
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
@@ -3915,54 +4228,64 @@ const factory = (env) => {
|
|
|
3915
4228
|
|
|
3916
4229
|
responseType = responseType || 'text';
|
|
3917
4230
|
|
|
3918
|
-
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
|
+
);
|
|
3919
4235
|
|
|
3920
4236
|
!isStreamResponse && unsubscribe && unsubscribe();
|
|
3921
4237
|
|
|
3922
4238
|
return await new Promise((resolve, reject) => {
|
|
3923
4239
|
settle(resolve, reject, {
|
|
3924
4240
|
data: responseData,
|
|
3925
|
-
headers: AxiosHeaders
|
|
4241
|
+
headers: AxiosHeaders.from(response.headers),
|
|
3926
4242
|
status: response.status,
|
|
3927
4243
|
statusText: response.statusText,
|
|
3928
4244
|
config,
|
|
3929
|
-
request
|
|
4245
|
+
request,
|
|
3930
4246
|
});
|
|
3931
|
-
})
|
|
4247
|
+
});
|
|
3932
4248
|
} catch (err) {
|
|
3933
4249
|
unsubscribe && unsubscribe();
|
|
3934
4250
|
|
|
3935
4251
|
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
|
3936
4252
|
throw Object.assign(
|
|
3937
|
-
new AxiosError(
|
|
4253
|
+
new AxiosError(
|
|
4254
|
+
'Network Error',
|
|
4255
|
+
AxiosError.ERR_NETWORK,
|
|
4256
|
+
config,
|
|
4257
|
+
request,
|
|
4258
|
+
err && err.response
|
|
4259
|
+
),
|
|
3938
4260
|
{
|
|
3939
|
-
cause: err.cause || err
|
|
4261
|
+
cause: err.cause || err,
|
|
3940
4262
|
}
|
|
3941
|
-
)
|
|
4263
|
+
);
|
|
3942
4264
|
}
|
|
3943
4265
|
|
|
3944
|
-
throw AxiosError.from(err, err && err.code, config, request);
|
|
4266
|
+
throw AxiosError.from(err, err && err.code, config, request, err && err.response);
|
|
3945
4267
|
}
|
|
3946
|
-
}
|
|
4268
|
+
};
|
|
3947
4269
|
};
|
|
3948
4270
|
|
|
3949
4271
|
const seedCache = new Map();
|
|
3950
4272
|
|
|
3951
4273
|
const getFetch = (config) => {
|
|
3952
4274
|
let env = (config && config.env) || {};
|
|
3953
|
-
const {fetch, Request, Response} = env;
|
|
3954
|
-
const seeds = [
|
|
3955
|
-
Request, Response, fetch
|
|
3956
|
-
];
|
|
4275
|
+
const { fetch, Request, Response } = env;
|
|
4276
|
+
const seeds = [Request, Response, fetch];
|
|
3957
4277
|
|
|
3958
|
-
let len = seeds.length,
|
|
3959
|
-
|
|
4278
|
+
let len = seeds.length,
|
|
4279
|
+
i = len,
|
|
4280
|
+
seed,
|
|
4281
|
+
target,
|
|
4282
|
+
map = seedCache;
|
|
3960
4283
|
|
|
3961
4284
|
while (i--) {
|
|
3962
4285
|
seed = seeds[i];
|
|
3963
4286
|
target = map.get(seed);
|
|
3964
4287
|
|
|
3965
|
-
target === undefined && map.set(seed, target =
|
|
4288
|
+
target === undefined && map.set(seed, (target = i ? new Map() : factory(env)));
|
|
3966
4289
|
|
|
3967
4290
|
map = target;
|
|
3968
4291
|
}
|
|
@@ -3978,7 +4301,7 @@ getFetch();
|
|
|
3978
4301
|
* - `http` for Node.js
|
|
3979
4302
|
* - `xhr` for browsers
|
|
3980
4303
|
* - `fetch` for fetch API-based requests
|
|
3981
|
-
*
|
|
4304
|
+
*
|
|
3982
4305
|
* @type {Object<string, Function|Object>}
|
|
3983
4306
|
*/
|
|
3984
4307
|
const knownAdapters = {
|
|
@@ -3986,7 +4309,7 @@ const knownAdapters = {
|
|
|
3986
4309
|
xhr: xhrAdapter,
|
|
3987
4310
|
fetch: {
|
|
3988
4311
|
get: getFetch,
|
|
3989
|
-
}
|
|
4312
|
+
},
|
|
3990
4313
|
};
|
|
3991
4314
|
|
|
3992
4315
|
// Assign adapter names for easier debugging and identification
|
|
@@ -4003,7 +4326,7 @@ utils$1.forEach(knownAdapters, (fn, value) => {
|
|
|
4003
4326
|
|
|
4004
4327
|
/**
|
|
4005
4328
|
* Render a rejection reason string for unknown or unsupported adapters
|
|
4006
|
-
*
|
|
4329
|
+
*
|
|
4007
4330
|
* @param {string} reason
|
|
4008
4331
|
* @returns {string}
|
|
4009
4332
|
*/
|
|
@@ -4011,17 +4334,18 @@ const renderReason = (reason) => `- ${reason}`;
|
|
|
4011
4334
|
|
|
4012
4335
|
/**
|
|
4013
4336
|
* Check if the adapter is resolved (function, null, or false)
|
|
4014
|
-
*
|
|
4337
|
+
*
|
|
4015
4338
|
* @param {Function|null|false} adapter
|
|
4016
4339
|
* @returns {boolean}
|
|
4017
4340
|
*/
|
|
4018
|
-
const isResolvedHandle = (adapter) =>
|
|
4341
|
+
const isResolvedHandle = (adapter) =>
|
|
4342
|
+
utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
4019
4343
|
|
|
4020
4344
|
/**
|
|
4021
4345
|
* Get the first suitable adapter from the provided list.
|
|
4022
4346
|
* Tries each adapter in order until a supported one is found.
|
|
4023
4347
|
* Throws an AxiosError if no adapter is suitable.
|
|
4024
|
-
*
|
|
4348
|
+
*
|
|
4025
4349
|
* @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
|
|
4026
4350
|
* @param {Object} config - Axios request configuration
|
|
4027
4351
|
* @throws {AxiosError} If no suitable adapter is available
|
|
@@ -4058,14 +4382,17 @@ function getAdapter(adapters, config) {
|
|
|
4058
4382
|
}
|
|
4059
4383
|
|
|
4060
4384
|
if (!adapter) {
|
|
4061
|
-
const reasons = Object.entries(rejectedReasons)
|
|
4062
|
-
|
|
4385
|
+
const reasons = Object.entries(rejectedReasons).map(
|
|
4386
|
+
([id, state]) =>
|
|
4387
|
+
`adapter ${id} ` +
|
|
4063
4388
|
(state === false ? 'is not supported by the environment' : 'is not available in the build')
|
|
4064
|
-
|
|
4389
|
+
);
|
|
4065
4390
|
|
|
4066
|
-
let s = length
|
|
4067
|
-
|
|
4068
|
-
|
|
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';
|
|
4069
4396
|
|
|
4070
4397
|
throw new AxiosError(
|
|
4071
4398
|
`There is no suitable adapter to dispatch the request ` + s,
|
|
@@ -4090,7 +4417,7 @@ var adapters = {
|
|
|
4090
4417
|
* Exposes all known adapters
|
|
4091
4418
|
* @type {Object<string, Function|Object>}
|
|
4092
4419
|
*/
|
|
4093
|
-
adapters: knownAdapters
|
|
4420
|
+
adapters: knownAdapters,
|
|
4094
4421
|
};
|
|
4095
4422
|
|
|
4096
4423
|
/**
|
|
@@ -4120,53 +4447,49 @@ function throwIfCancellationRequested(config) {
|
|
|
4120
4447
|
function dispatchRequest(config) {
|
|
4121
4448
|
throwIfCancellationRequested(config);
|
|
4122
4449
|
|
|
4123
|
-
config.headers = AxiosHeaders
|
|
4450
|
+
config.headers = AxiosHeaders.from(config.headers);
|
|
4124
4451
|
|
|
4125
4452
|
// Transform request data
|
|
4126
|
-
config.data = transformData.call(
|
|
4127
|
-
config,
|
|
4128
|
-
config.transformRequest
|
|
4129
|
-
);
|
|
4453
|
+
config.data = transformData.call(config, config.transformRequest);
|
|
4130
4454
|
|
|
4131
4455
|
if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
|
|
4132
4456
|
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
|
4133
4457
|
}
|
|
4134
4458
|
|
|
4135
|
-
const adapter = adapters.getAdapter(config.adapter || defaults
|
|
4136
|
-
|
|
4137
|
-
return adapter(config).then(function onAdapterResolution(response) {
|
|
4138
|
-
throwIfCancellationRequested(config);
|
|
4459
|
+
const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
|
|
4139
4460
|
|
|
4140
|
-
|
|
4141
|
-
response
|
|
4142
|
-
config,
|
|
4143
|
-
config.transformResponse,
|
|
4144
|
-
response
|
|
4145
|
-
);
|
|
4146
|
-
|
|
4147
|
-
response.headers = AxiosHeaders$1.from(response.headers);
|
|
4148
|
-
|
|
4149
|
-
return response;
|
|
4150
|
-
}, function onAdapterRejection(reason) {
|
|
4151
|
-
if (!isCancel(reason)) {
|
|
4461
|
+
return adapter(config).then(
|
|
4462
|
+
function onAdapterResolution(response) {
|
|
4152
4463
|
throwIfCancellationRequested(config);
|
|
4153
4464
|
|
|
4154
4465
|
// Transform response data
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
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
|
+
}
|
|
4162
4485
|
}
|
|
4163
|
-
}
|
|
4164
4486
|
|
|
4165
|
-
|
|
4166
|
-
|
|
4487
|
+
return Promise.reject(reason);
|
|
4488
|
+
}
|
|
4489
|
+
);
|
|
4167
4490
|
}
|
|
4168
4491
|
|
|
4169
|
-
const VERSION = "1.
|
|
4492
|
+
const VERSION = "1.15.0";
|
|
4170
4493
|
|
|
4171
4494
|
const validators$1 = {};
|
|
4172
4495
|
|
|
@@ -4190,7 +4513,15 @@ const deprecatedWarnings = {};
|
|
|
4190
4513
|
*/
|
|
4191
4514
|
validators$1.transitional = function transitional(validator, version, message) {
|
|
4192
4515
|
function formatMessage(opt, desc) {
|
|
4193
|
-
return
|
|
4516
|
+
return (
|
|
4517
|
+
'[Axios v' +
|
|
4518
|
+
VERSION +
|
|
4519
|
+
"] Transitional option '" +
|
|
4520
|
+
opt +
|
|
4521
|
+
"'" +
|
|
4522
|
+
desc +
|
|
4523
|
+
(message ? '. ' + message : '')
|
|
4524
|
+
);
|
|
4194
4525
|
}
|
|
4195
4526
|
|
|
4196
4527
|
// eslint-disable-next-line func-names
|
|
@@ -4222,7 +4553,7 @@ validators$1.spelling = function spelling(correctSpelling) {
|
|
|
4222
4553
|
// eslint-disable-next-line no-console
|
|
4223
4554
|
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
|
|
4224
4555
|
return true;
|
|
4225
|
-
}
|
|
4556
|
+
};
|
|
4226
4557
|
};
|
|
4227
4558
|
|
|
4228
4559
|
/**
|
|
@@ -4248,7 +4579,10 @@ function assertOptions(options, schema, allowUnknown) {
|
|
|
4248
4579
|
const value = options[opt];
|
|
4249
4580
|
const result = value === undefined || validator(value, opt, options);
|
|
4250
4581
|
if (result !== true) {
|
|
4251
|
-
throw new AxiosError(
|
|
4582
|
+
throw new AxiosError(
|
|
4583
|
+
'option ' + opt + ' must be ' + result,
|
|
4584
|
+
AxiosError.ERR_BAD_OPTION_VALUE
|
|
4585
|
+
);
|
|
4252
4586
|
}
|
|
4253
4587
|
continue;
|
|
4254
4588
|
}
|
|
@@ -4260,7 +4594,7 @@ function assertOptions(options, schema, allowUnknown) {
|
|
|
4260
4594
|
|
|
4261
4595
|
var validator = {
|
|
4262
4596
|
assertOptions,
|
|
4263
|
-
validators: validators$1
|
|
4597
|
+
validators: validators$1,
|
|
4264
4598
|
};
|
|
4265
4599
|
|
|
4266
4600
|
const validators = validator.validators;
|
|
@@ -4276,8 +4610,8 @@ class Axios {
|
|
|
4276
4610
|
constructor(instanceConfig) {
|
|
4277
4611
|
this.defaults = instanceConfig || {};
|
|
4278
4612
|
this.interceptors = {
|
|
4279
|
-
request: new InterceptorManager
|
|
4280
|
-
response: new InterceptorManager
|
|
4613
|
+
request: new InterceptorManager(),
|
|
4614
|
+
response: new InterceptorManager(),
|
|
4281
4615
|
};
|
|
4282
4616
|
}
|
|
4283
4617
|
|
|
@@ -4299,13 +4633,29 @@ class Axios {
|
|
|
4299
4633
|
Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
|
|
4300
4634
|
|
|
4301
4635
|
// slice off the Error: ... line
|
|
4302
|
-
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
|
+
})();
|
|
4303
4645
|
try {
|
|
4304
4646
|
if (!err.stack) {
|
|
4305
4647
|
err.stack = stack;
|
|
4306
4648
|
// match without the 2 top stack lines
|
|
4307
|
-
} else if (stack
|
|
4308
|
-
|
|
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
|
+
}
|
|
4309
4659
|
}
|
|
4310
4660
|
} catch (e) {
|
|
4311
4661
|
// ignore the case where "stack" is an un-writable property
|
|
@@ -4328,26 +4678,35 @@ class Axios {
|
|
|
4328
4678
|
|
|
4329
4679
|
config = mergeConfig(this.defaults, config);
|
|
4330
4680
|
|
|
4331
|
-
const {transitional, paramsSerializer, headers} = config;
|
|
4681
|
+
const { transitional, paramsSerializer, headers } = config;
|
|
4332
4682
|
|
|
4333
4683
|
if (transitional !== undefined) {
|
|
4334
|
-
validator.assertOptions(
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
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
|
+
);
|
|
4339
4694
|
}
|
|
4340
4695
|
|
|
4341
4696
|
if (paramsSerializer != null) {
|
|
4342
4697
|
if (utils$1.isFunction(paramsSerializer)) {
|
|
4343
4698
|
config.paramsSerializer = {
|
|
4344
|
-
serialize: paramsSerializer
|
|
4699
|
+
serialize: paramsSerializer,
|
|
4345
4700
|
};
|
|
4346
4701
|
} else {
|
|
4347
|
-
validator.assertOptions(
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4702
|
+
validator.assertOptions(
|
|
4703
|
+
paramsSerializer,
|
|
4704
|
+
{
|
|
4705
|
+
encode: validators.function,
|
|
4706
|
+
serialize: validators.function,
|
|
4707
|
+
},
|
|
4708
|
+
true
|
|
4709
|
+
);
|
|
4351
4710
|
}
|
|
4352
4711
|
}
|
|
4353
4712
|
|
|
@@ -4358,28 +4717,27 @@ class Axios {
|
|
|
4358
4717
|
config.allowAbsoluteUrls = true;
|
|
4359
4718
|
}
|
|
4360
4719
|
|
|
4361
|
-
validator.assertOptions(
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4720
|
+
validator.assertOptions(
|
|
4721
|
+
config,
|
|
4722
|
+
{
|
|
4723
|
+
baseUrl: validators.spelling('baseURL'),
|
|
4724
|
+
withXsrfToken: validators.spelling('withXSRFToken'),
|
|
4725
|
+
},
|
|
4726
|
+
true
|
|
4727
|
+
);
|
|
4365
4728
|
|
|
4366
4729
|
// Set config.method
|
|
4367
4730
|
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
|
4368
4731
|
|
|
4369
4732
|
// Flatten headers
|
|
4370
|
-
let contextHeaders = headers && utils$1.merge(
|
|
4371
|
-
headers.common,
|
|
4372
|
-
headers[config.method]
|
|
4373
|
-
);
|
|
4733
|
+
let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
|
|
4374
4734
|
|
|
4375
|
-
headers &&
|
|
4376
|
-
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
|
4377
|
-
(method) => {
|
|
4735
|
+
headers &&
|
|
4736
|
+
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], (method) => {
|
|
4378
4737
|
delete headers[method];
|
|
4379
|
-
}
|
|
4380
|
-
);
|
|
4738
|
+
});
|
|
4381
4739
|
|
|
4382
|
-
config.headers = AxiosHeaders
|
|
4740
|
+
config.headers = AxiosHeaders.concat(contextHeaders, headers);
|
|
4383
4741
|
|
|
4384
4742
|
// filter out skipped interceptors
|
|
4385
4743
|
const requestInterceptorChain = [];
|
|
@@ -4391,7 +4749,15 @@ class Axios {
|
|
|
4391
4749
|
|
|
4392
4750
|
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
4393
4751
|
|
|
4394
|
-
|
|
4752
|
+
const transitional = config.transitional || transitionalDefaults;
|
|
4753
|
+
const legacyInterceptorReqResOrdering =
|
|
4754
|
+
transitional && transitional.legacyInterceptorReqResOrdering;
|
|
4755
|
+
|
|
4756
|
+
if (legacyInterceptorReqResOrdering) {
|
|
4757
|
+
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
4758
|
+
} else {
|
|
4759
|
+
requestInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
4760
|
+
}
|
|
4395
4761
|
});
|
|
4396
4762
|
|
|
4397
4763
|
const responseInterceptorChain = [];
|
|
@@ -4459,28 +4825,32 @@ class Axios {
|
|
|
4459
4825
|
// Provide aliases for supported request methods
|
|
4460
4826
|
utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
|
4461
4827
|
/*eslint func-names:0*/
|
|
4462
|
-
Axios.prototype[method] = function(url, config) {
|
|
4463
|
-
return this.request(
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4828
|
+
Axios.prototype[method] = function (url, config) {
|
|
4829
|
+
return this.request(
|
|
4830
|
+
mergeConfig(config || {}, {
|
|
4831
|
+
method,
|
|
4832
|
+
url,
|
|
4833
|
+
data: (config || {}).data,
|
|
4834
|
+
})
|
|
4835
|
+
);
|
|
4468
4836
|
};
|
|
4469
4837
|
});
|
|
4470
4838
|
|
|
4471
4839
|
utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
4472
|
-
/*eslint func-names:0*/
|
|
4473
|
-
|
|
4474
4840
|
function generateHTTPMethod(isForm) {
|
|
4475
4841
|
return function httpMethod(url, data, config) {
|
|
4476
|
-
return this.request(
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
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
|
+
);
|
|
4484
4854
|
};
|
|
4485
4855
|
}
|
|
4486
4856
|
|
|
@@ -4489,8 +4859,6 @@ utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method)
|
|
|
4489
4859
|
Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
|
|
4490
4860
|
});
|
|
4491
4861
|
|
|
4492
|
-
var Axios$1 = Axios;
|
|
4493
|
-
|
|
4494
4862
|
/**
|
|
4495
4863
|
* A `CancelToken` is an object that can be used to request cancellation of an operation.
|
|
4496
4864
|
*
|
|
@@ -4513,7 +4881,7 @@ class CancelToken {
|
|
|
4513
4881
|
const token = this;
|
|
4514
4882
|
|
|
4515
4883
|
// eslint-disable-next-line func-names
|
|
4516
|
-
this.promise.then(cancel => {
|
|
4884
|
+
this.promise.then((cancel) => {
|
|
4517
4885
|
if (!token._listeners) return;
|
|
4518
4886
|
|
|
4519
4887
|
let i = token._listeners.length;
|
|
@@ -4525,10 +4893,10 @@ class CancelToken {
|
|
|
4525
4893
|
});
|
|
4526
4894
|
|
|
4527
4895
|
// eslint-disable-next-line func-names
|
|
4528
|
-
this.promise.then = onfulfilled => {
|
|
4896
|
+
this.promise.then = (onfulfilled) => {
|
|
4529
4897
|
let _resolve;
|
|
4530
4898
|
// eslint-disable-next-line func-names
|
|
4531
|
-
const promise = new Promise(resolve => {
|
|
4899
|
+
const promise = new Promise((resolve) => {
|
|
4532
4900
|
token.subscribe(resolve);
|
|
4533
4901
|
_resolve = resolve;
|
|
4534
4902
|
}).then(onfulfilled);
|
|
@@ -4616,13 +4984,11 @@ class CancelToken {
|
|
|
4616
4984
|
});
|
|
4617
4985
|
return {
|
|
4618
4986
|
token,
|
|
4619
|
-
cancel
|
|
4987
|
+
cancel,
|
|
4620
4988
|
};
|
|
4621
4989
|
}
|
|
4622
4990
|
}
|
|
4623
4991
|
|
|
4624
|
-
var CancelToken$1 = CancelToken;
|
|
4625
|
-
|
|
4626
4992
|
/**
|
|
4627
4993
|
* Syntactic sugar for invoking a function and expanding an array for arguments.
|
|
4628
4994
|
*
|
|
@@ -4630,7 +4996,7 @@ var CancelToken$1 = CancelToken;
|
|
|
4630
4996
|
*
|
|
4631
4997
|
* ```js
|
|
4632
4998
|
* function f(x, y, z) {}
|
|
4633
|
-
*
|
|
4999
|
+
* const args = [1, 2, 3];
|
|
4634
5000
|
* f.apply(null, args);
|
|
4635
5001
|
* ```
|
|
4636
5002
|
*
|
|
@@ -4658,7 +5024,7 @@ function spread(callback) {
|
|
|
4658
5024
|
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
|
4659
5025
|
*/
|
|
4660
5026
|
function isAxiosError(payload) {
|
|
4661
|
-
return utils$1.isObject(payload) &&
|
|
5027
|
+
return utils$1.isObject(payload) && payload.isAxiosError === true;
|
|
4662
5028
|
}
|
|
4663
5029
|
|
|
4664
5030
|
const HttpStatusCode = {
|
|
@@ -4737,8 +5103,6 @@ Object.entries(HttpStatusCode).forEach(([key, value]) => {
|
|
|
4737
5103
|
HttpStatusCode[value] = key;
|
|
4738
5104
|
});
|
|
4739
5105
|
|
|
4740
|
-
var HttpStatusCode$1 = HttpStatusCode;
|
|
4741
|
-
|
|
4742
5106
|
/**
|
|
4743
5107
|
* Create an instance of Axios
|
|
4744
5108
|
*
|
|
@@ -4747,14 +5111,14 @@ var HttpStatusCode$1 = HttpStatusCode;
|
|
|
4747
5111
|
* @returns {Axios} A new instance of Axios
|
|
4748
5112
|
*/
|
|
4749
5113
|
function createInstance(defaultConfig) {
|
|
4750
|
-
const context = new Axios
|
|
4751
|
-
const instance = bind(Axios
|
|
5114
|
+
const context = new Axios(defaultConfig);
|
|
5115
|
+
const instance = bind(Axios.prototype.request, context);
|
|
4752
5116
|
|
|
4753
5117
|
// Copy axios.prototype to instance
|
|
4754
|
-
utils$1.extend(instance, Axios
|
|
5118
|
+
utils$1.extend(instance, Axios.prototype, context, { allOwnKeys: true });
|
|
4755
5119
|
|
|
4756
5120
|
// Copy context to instance
|
|
4757
|
-
utils$1.extend(instance, context, null, {allOwnKeys: true});
|
|
5121
|
+
utils$1.extend(instance, context, null, { allOwnKeys: true });
|
|
4758
5122
|
|
|
4759
5123
|
// Factory for creating new instances
|
|
4760
5124
|
instance.create = function create(instanceConfig) {
|
|
@@ -4765,14 +5129,14 @@ function createInstance(defaultConfig) {
|
|
|
4765
5129
|
}
|
|
4766
5130
|
|
|
4767
5131
|
// Create the default instance to be exported
|
|
4768
|
-
const axios = createInstance(defaults
|
|
5132
|
+
const axios = createInstance(defaults);
|
|
4769
5133
|
|
|
4770
5134
|
// Expose Axios class to allow class inheritance
|
|
4771
|
-
axios.Axios = Axios
|
|
5135
|
+
axios.Axios = Axios;
|
|
4772
5136
|
|
|
4773
5137
|
// Expose Cancel & CancelToken
|
|
4774
5138
|
axios.CanceledError = CanceledError;
|
|
4775
|
-
axios.CancelToken = CancelToken
|
|
5139
|
+
axios.CancelToken = CancelToken;
|
|
4776
5140
|
axios.isCancel = isCancel;
|
|
4777
5141
|
axios.VERSION = VERSION;
|
|
4778
5142
|
axios.toFormData = toFormData;
|
|
@@ -4796,13 +5160,13 @@ axios.isAxiosError = isAxiosError;
|
|
|
4796
5160
|
// Expose mergeConfig
|
|
4797
5161
|
axios.mergeConfig = mergeConfig;
|
|
4798
5162
|
|
|
4799
|
-
axios.AxiosHeaders = AxiosHeaders
|
|
5163
|
+
axios.AxiosHeaders = AxiosHeaders;
|
|
4800
5164
|
|
|
4801
|
-
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);
|
|
4802
5166
|
|
|
4803
5167
|
axios.getAdapter = adapters.getAdapter;
|
|
4804
5168
|
|
|
4805
|
-
axios.HttpStatusCode = HttpStatusCode
|
|
5169
|
+
axios.HttpStatusCode = HttpStatusCode;
|
|
4806
5170
|
|
|
4807
5171
|
axios.default = axios;
|
|
4808
5172
|
|
|
@@ -4810,7 +5174,7 @@ module.exports = axios;
|
|
|
4810
5174
|
//# sourceMappingURL=axios.cjs.map
|
|
4811
5175
|
|
|
4812
5176
|
|
|
4813
|
-
/***/ }
|
|
5177
|
+
/***/ }
|
|
4814
5178
|
|
|
4815
5179
|
/******/ });
|
|
4816
5180
|
/************************************************************************/
|
|
@@ -4832,6 +5196,12 @@ module.exports = axios;
|
|
|
4832
5196
|
/******/ };
|
|
4833
5197
|
/******/
|
|
4834
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
|
+
/******/ }
|
|
4835
5205
|
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
4836
5206
|
/******/
|
|
4837
5207
|
/******/ // Return the exports of the module
|