axios 1.10.0 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -0
- package/README.md +13 -13
- package/dist/axios.js +395 -292
- package/dist/axios.js.map +1 -1
- package/dist/axios.min.js +2 -2
- package/dist/axios.min.js.map +1 -1
- package/dist/browser/axios.cjs +329 -217
- package/dist/browser/axios.cjs.map +1 -1
- package/dist/esm/axios.js +329 -217
- package/dist/esm/axios.js.map +1 -1
- package/dist/esm/axios.min.js +2 -2
- package/dist/esm/axios.min.js.map +1 -1
- package/dist/node/axios.cjs +420 -217
- package/dist/node/axios.cjs.map +1 -1
- package/index.d.cts +22 -7
- package/index.d.ts +10 -4
- package/lib/adapters/adapters.js +6 -4
- package/lib/adapters/fetch.js +220 -163
- package/lib/adapters/http.js +18 -0
- package/lib/adapters/xhr.js +11 -8
- package/lib/core/Axios.js +2 -2
- package/lib/core/AxiosError.js +10 -3
- package/lib/core/dispatchRequest.js +1 -1
- package/lib/core/mergeConfig.js +1 -1
- package/lib/defaults/index.js +1 -1
- package/lib/env/data.js +1 -1
- package/lib/helpers/buildURL.js +1 -3
- package/lib/helpers/estimateDataURLDecodedBytes.js +73 -0
- package/lib/helpers/resolveConfig.js +13 -9
- package/lib/helpers/throttle.js +1 -1
- package/lib/helpers/toURLEncodedForm.js +4 -3
- package/lib/utils.js +42 -2
- package/package.json +15 -12
package/dist/axios.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Axios v1.
|
|
1
|
+
/*! Axios v1.12.0 Copyright (c) 2025 Matt Zabriskie and contributors */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -585,9 +585,6 @@
|
|
|
585
585
|
function _slicedToArray(arr, i) {
|
|
586
586
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
587
587
|
}
|
|
588
|
-
function _toArray(arr) {
|
|
589
|
-
return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest();
|
|
590
|
-
}
|
|
591
588
|
function _toConsumableArray(arr) {
|
|
592
589
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
593
590
|
}
|
|
@@ -727,7 +724,7 @@
|
|
|
727
724
|
* @returns {boolean} True if value is a Buffer, otherwise false
|
|
728
725
|
*/
|
|
729
726
|
function isBuffer(val) {
|
|
730
|
-
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
727
|
+
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
731
728
|
}
|
|
732
729
|
|
|
733
730
|
/**
|
|
@@ -771,7 +768,7 @@
|
|
|
771
768
|
* @param {*} val The value to test
|
|
772
769
|
* @returns {boolean} True if value is a Function, otherwise false
|
|
773
770
|
*/
|
|
774
|
-
var isFunction = typeOfTest('function');
|
|
771
|
+
var isFunction$1 = typeOfTest('function');
|
|
775
772
|
|
|
776
773
|
/**
|
|
777
774
|
* Determine if a value is a Number
|
|
@@ -818,6 +815,26 @@
|
|
|
818
815
|
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
|
|
819
816
|
};
|
|
820
817
|
|
|
818
|
+
/**
|
|
819
|
+
* Determine if a value is an empty object (safely handles Buffers)
|
|
820
|
+
*
|
|
821
|
+
* @param {*} val The value to test
|
|
822
|
+
*
|
|
823
|
+
* @returns {boolean} True if value is an empty object, otherwise false
|
|
824
|
+
*/
|
|
825
|
+
var isEmptyObject = function isEmptyObject(val) {
|
|
826
|
+
// Early return for non-objects or Buffers to prevent RangeError
|
|
827
|
+
if (!isObject(val) || isBuffer(val)) {
|
|
828
|
+
return false;
|
|
829
|
+
}
|
|
830
|
+
try {
|
|
831
|
+
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
|
832
|
+
} catch (e) {
|
|
833
|
+
// Fallback for any other objects that might cause RangeError with Object.keys()
|
|
834
|
+
return false;
|
|
835
|
+
}
|
|
836
|
+
};
|
|
837
|
+
|
|
821
838
|
/**
|
|
822
839
|
* Determine if a value is a Date
|
|
823
840
|
*
|
|
@@ -862,7 +879,7 @@
|
|
|
862
879
|
* @returns {boolean} True if value is a Stream, otherwise false
|
|
863
880
|
*/
|
|
864
881
|
var isStream = function isStream(val) {
|
|
865
|
-
return isObject(val) && isFunction(val.pipe);
|
|
882
|
+
return isObject(val) && isFunction$1(val.pipe);
|
|
866
883
|
};
|
|
867
884
|
|
|
868
885
|
/**
|
|
@@ -874,9 +891,9 @@
|
|
|
874
891
|
*/
|
|
875
892
|
var isFormData = function isFormData(thing) {
|
|
876
893
|
var kind;
|
|
877
|
-
return thing && (typeof FormData === 'function' && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === 'formdata' ||
|
|
894
|
+
return thing && (typeof FormData === 'function' && thing instanceof FormData || isFunction$1(thing.append) && ((kind = kindOf(thing)) === 'formdata' ||
|
|
878
895
|
// detect form-data instance
|
|
879
|
-
kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]'));
|
|
896
|
+
kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]'));
|
|
880
897
|
};
|
|
881
898
|
|
|
882
899
|
/**
|
|
@@ -942,6 +959,11 @@
|
|
|
942
959
|
fn.call(null, obj[i], i, obj);
|
|
943
960
|
}
|
|
944
961
|
} else {
|
|
962
|
+
// Buffer check
|
|
963
|
+
if (isBuffer(obj)) {
|
|
964
|
+
return;
|
|
965
|
+
}
|
|
966
|
+
|
|
945
967
|
// Iterate over object keys
|
|
946
968
|
var keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
947
969
|
var len = keys.length;
|
|
@@ -953,6 +975,9 @@
|
|
|
953
975
|
}
|
|
954
976
|
}
|
|
955
977
|
function findKey(obj, key) {
|
|
978
|
+
if (isBuffer(obj)) {
|
|
979
|
+
return null;
|
|
980
|
+
}
|
|
956
981
|
key = key.toLowerCase();
|
|
957
982
|
var keys = Object.keys(obj);
|
|
958
983
|
var i = keys.length;
|
|
@@ -995,7 +1020,8 @@
|
|
|
995
1020
|
function merge( /* obj1, obj2, obj3, ... */
|
|
996
1021
|
) {
|
|
997
1022
|
var _ref2 = isContextDefined(this) && this || {},
|
|
998
|
-
caseless = _ref2.caseless
|
|
1023
|
+
caseless = _ref2.caseless,
|
|
1024
|
+
skipUndefined = _ref2.skipUndefined;
|
|
999
1025
|
var result = {};
|
|
1000
1026
|
var assignValue = function assignValue(val, key) {
|
|
1001
1027
|
var targetKey = caseless && findKey(result, key) || key;
|
|
@@ -1006,7 +1032,9 @@
|
|
|
1006
1032
|
} else if (isArray(val)) {
|
|
1007
1033
|
result[targetKey] = val.slice();
|
|
1008
1034
|
} else {
|
|
1009
|
-
|
|
1035
|
+
if (!skipUndefined || !isUndefined(val)) {
|
|
1036
|
+
result[targetKey] = val;
|
|
1037
|
+
}
|
|
1010
1038
|
}
|
|
1011
1039
|
};
|
|
1012
1040
|
for (var i = 0, l = arguments.length; i < l; i++) {
|
|
@@ -1029,7 +1057,7 @@
|
|
|
1029
1057
|
var _ref3 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
|
|
1030
1058
|
allOwnKeys = _ref3.allOwnKeys;
|
|
1031
1059
|
forEach(b, function (val, key) {
|
|
1032
|
-
if (thisArg && isFunction(val)) {
|
|
1060
|
+
if (thisArg && isFunction$1(val)) {
|
|
1033
1061
|
a[key] = bind(val, thisArg);
|
|
1034
1062
|
} else {
|
|
1035
1063
|
a[key] = val;
|
|
@@ -1237,11 +1265,11 @@
|
|
|
1237
1265
|
var freezeMethods = function freezeMethods(obj) {
|
|
1238
1266
|
reduceDescriptors(obj, function (descriptor, name) {
|
|
1239
1267
|
// skip restricted props in strict mode
|
|
1240
|
-
if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
|
1268
|
+
if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
|
1241
1269
|
return false;
|
|
1242
1270
|
}
|
|
1243
1271
|
var value = obj[name];
|
|
1244
|
-
if (!isFunction(value)) return;
|
|
1272
|
+
if (!isFunction$1(value)) return;
|
|
1245
1273
|
descriptor.enumerable = false;
|
|
1246
1274
|
if ('writable' in descriptor) {
|
|
1247
1275
|
descriptor.writable = false;
|
|
@@ -1277,7 +1305,7 @@
|
|
|
1277
1305
|
* @returns {boolean}
|
|
1278
1306
|
*/
|
|
1279
1307
|
function isSpecCompliantForm(thing) {
|
|
1280
|
-
return !!(thing && isFunction(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
|
|
1308
|
+
return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
|
|
1281
1309
|
}
|
|
1282
1310
|
var toJSONObject = function toJSONObject(obj) {
|
|
1283
1311
|
var stack = new Array(10);
|
|
@@ -1286,6 +1314,11 @@
|
|
|
1286
1314
|
if (stack.indexOf(source) >= 0) {
|
|
1287
1315
|
return;
|
|
1288
1316
|
}
|
|
1317
|
+
|
|
1318
|
+
//Buffer check
|
|
1319
|
+
if (isBuffer(source)) {
|
|
1320
|
+
return source;
|
|
1321
|
+
}
|
|
1289
1322
|
if (!('toJSON' in source)) {
|
|
1290
1323
|
stack[i] = source;
|
|
1291
1324
|
var target = isArray(source) ? [] : {};
|
|
@@ -1303,7 +1336,7 @@
|
|
|
1303
1336
|
};
|
|
1304
1337
|
var isAsyncFn = kindOfTest('AsyncFunction');
|
|
1305
1338
|
var isThenable = function isThenable(thing) {
|
|
1306
|
-
return thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing["catch"]);
|
|
1339
|
+
return thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing["catch"]);
|
|
1307
1340
|
};
|
|
1308
1341
|
|
|
1309
1342
|
// original code
|
|
@@ -1328,13 +1361,13 @@
|
|
|
1328
1361
|
}("axios@".concat(Math.random()), []) : function (cb) {
|
|
1329
1362
|
return setTimeout(cb);
|
|
1330
1363
|
};
|
|
1331
|
-
}(typeof setImmediate === 'function', isFunction(_global.postMessage));
|
|
1364
|
+
}(typeof setImmediate === 'function', isFunction$1(_global.postMessage));
|
|
1332
1365
|
var asap = typeof queueMicrotask !== 'undefined' ? queueMicrotask.bind(_global) : typeof process !== 'undefined' && process.nextTick || _setImmediate;
|
|
1333
1366
|
|
|
1334
1367
|
// *********************
|
|
1335
1368
|
|
|
1336
1369
|
var isIterable = function isIterable(thing) {
|
|
1337
|
-
return thing != null && isFunction(thing[iterator]);
|
|
1370
|
+
return thing != null && isFunction$1(thing[iterator]);
|
|
1338
1371
|
};
|
|
1339
1372
|
var utils$1 = {
|
|
1340
1373
|
isArray: isArray,
|
|
@@ -1347,6 +1380,7 @@
|
|
|
1347
1380
|
isBoolean: isBoolean,
|
|
1348
1381
|
isObject: isObject,
|
|
1349
1382
|
isPlainObject: isPlainObject,
|
|
1383
|
+
isEmptyObject: isEmptyObject,
|
|
1350
1384
|
isReadableStream: isReadableStream,
|
|
1351
1385
|
isRequest: isRequest,
|
|
1352
1386
|
isResponse: isResponse,
|
|
@@ -1356,7 +1390,7 @@
|
|
|
1356
1390
|
isFile: isFile,
|
|
1357
1391
|
isBlob: isBlob,
|
|
1358
1392
|
isRegExp: isRegExp,
|
|
1359
|
-
isFunction: isFunction,
|
|
1393
|
+
isFunction: isFunction$1,
|
|
1360
1394
|
isStream: isStream,
|
|
1361
1395
|
isURLSearchParams: isURLSearchParams,
|
|
1362
1396
|
isTypedArray: isTypedArray,
|
|
@@ -1467,9 +1501,20 @@
|
|
|
1467
1501
|
}, function (prop) {
|
|
1468
1502
|
return prop !== 'isAxiosError';
|
|
1469
1503
|
});
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1504
|
+
var msg = error && error.message ? error.message : 'Error';
|
|
1505
|
+
|
|
1506
|
+
// Prefer explicit code; otherwise copy the low-level error's code (e.g. ECONNREFUSED)
|
|
1507
|
+
var errCode = code == null && error ? error.code : code;
|
|
1508
|
+
AxiosError.call(axiosError, msg, errCode, config, request, response);
|
|
1509
|
+
|
|
1510
|
+
// Chain the original error on the standard field; non-enumerable to avoid JSON noise
|
|
1511
|
+
if (error && axiosError.cause == null) {
|
|
1512
|
+
Object.defineProperty(axiosError, 'cause', {
|
|
1513
|
+
value: error,
|
|
1514
|
+
configurable: true
|
|
1515
|
+
});
|
|
1516
|
+
}
|
|
1517
|
+
axiosError.name = error && error.name || 'Error';
|
|
1473
1518
|
customProps && Object.assign(axiosError, customProps);
|
|
1474
1519
|
return axiosError;
|
|
1475
1520
|
};
|
|
@@ -1717,7 +1762,7 @@
|
|
|
1717
1762
|
* @returns {string} The encoded value.
|
|
1718
1763
|
*/
|
|
1719
1764
|
function encode(val) {
|
|
1720
|
-
return encodeURIComponent(val).replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+')
|
|
1765
|
+
return encodeURIComponent(val).replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+');
|
|
1721
1766
|
}
|
|
1722
1767
|
|
|
1723
1768
|
/**
|
|
@@ -1907,7 +1952,7 @@
|
|
|
1907
1952
|
var platform = _objectSpread2(_objectSpread2({}, utils), platform$1);
|
|
1908
1953
|
|
|
1909
1954
|
function toURLEncodedForm(data, options) {
|
|
1910
|
-
return toFormData(data, new platform.classes.URLSearchParams(),
|
|
1955
|
+
return toFormData(data, new platform.classes.URLSearchParams(), _objectSpread2({
|
|
1911
1956
|
visitor: function visitor(value, key, path, helpers) {
|
|
1912
1957
|
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
1913
1958
|
this.append(key, value.toString('base64'));
|
|
@@ -2072,7 +2117,7 @@
|
|
|
2072
2117
|
var silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
2073
2118
|
var strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
2074
2119
|
try {
|
|
2075
|
-
return JSON.parse(data);
|
|
2120
|
+
return JSON.parse(data, this.parseReviver);
|
|
2076
2121
|
} catch (e) {
|
|
2077
2122
|
if (strictJSONParsing) {
|
|
2078
2123
|
if (e.name === 'SyntaxError') {
|
|
@@ -2576,7 +2621,7 @@
|
|
|
2576
2621
|
clearTimeout(timer);
|
|
2577
2622
|
timer = null;
|
|
2578
2623
|
}
|
|
2579
|
-
fn.apply(
|
|
2624
|
+
fn.apply(void 0, _toConsumableArray(args));
|
|
2580
2625
|
};
|
|
2581
2626
|
var throttled = function throttled() {
|
|
2582
2627
|
var now = Date.now();
|
|
@@ -2824,7 +2869,7 @@
|
|
|
2824
2869
|
return mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true);
|
|
2825
2870
|
}
|
|
2826
2871
|
};
|
|
2827
|
-
utils$1.forEach(Object.keys(
|
|
2872
|
+
utils$1.forEach(Object.keys(_objectSpread2(_objectSpread2({}, config1), config2)), function computeConfigValue(prop) {
|
|
2828
2873
|
var merge = mergeMap[prop] || mergeDeepProperties;
|
|
2829
2874
|
var configValue = merge(config1[prop], config2[prop], prop);
|
|
2830
2875
|
utils$1.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
|
|
@@ -2847,19 +2892,22 @@
|
|
|
2847
2892
|
if (auth) {
|
|
2848
2893
|
headers.set('Authorization', 'Basic ' + btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : '')));
|
|
2849
2894
|
}
|
|
2850
|
-
var contentType;
|
|
2851
2895
|
if (utils$1.isFormData(data)) {
|
|
2852
2896
|
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
2853
|
-
headers.setContentType(undefined); //
|
|
2854
|
-
} else if ((
|
|
2855
|
-
//
|
|
2856
|
-
var
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2897
|
+
headers.setContentType(undefined); // browser handles it
|
|
2898
|
+
} else if (utils$1.isFunction(data.getHeaders)) {
|
|
2899
|
+
// Node.js FormData (like form-data package)
|
|
2900
|
+
var formHeaders = data.getHeaders();
|
|
2901
|
+
// Only set safe headers to avoid overwriting security headers
|
|
2902
|
+
var allowedHeaders = ['content-type', 'content-length'];
|
|
2903
|
+
Object.entries(formHeaders).forEach(function (_ref) {
|
|
2904
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
2905
|
+
key = _ref2[0],
|
|
2906
|
+
val = _ref2[1];
|
|
2907
|
+
if (allowedHeaders.includes(key.toLowerCase())) {
|
|
2908
|
+
headers.set(key, val);
|
|
2909
|
+
}
|
|
2910
|
+
});
|
|
2863
2911
|
}
|
|
2864
2912
|
}
|
|
2865
2913
|
|
|
@@ -2965,12 +3013,15 @@
|
|
|
2965
3013
|
};
|
|
2966
3014
|
|
|
2967
3015
|
// Handle low level network errors
|
|
2968
|
-
request.onerror = function handleError() {
|
|
2969
|
-
//
|
|
2970
|
-
//
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
3016
|
+
request.onerror = function handleError(event) {
|
|
3017
|
+
// Browsers deliver a ProgressEvent in XHR onerror
|
|
3018
|
+
// (message may be empty; when present, surface it)
|
|
3019
|
+
// See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
|
|
3020
|
+
var msg = event && event.message ? event.message : 'Network Error';
|
|
3021
|
+
var err = new AxiosError(msg, AxiosError.ERR_NETWORK, config, request);
|
|
3022
|
+
// attach the underlying event for consumers who want details
|
|
3023
|
+
err.event = event || null;
|
|
3024
|
+
reject(err);
|
|
2974
3025
|
request = null;
|
|
2975
3026
|
};
|
|
2976
3027
|
|
|
@@ -3299,35 +3350,21 @@
|
|
|
3299
3350
|
});
|
|
3300
3351
|
};
|
|
3301
3352
|
|
|
3302
|
-
var
|
|
3303
|
-
var
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3313
|
-
while (1) switch (_context.prev = _context.next) {
|
|
3314
|
-
case 0:
|
|
3315
|
-
_context.t0 = Uint8Array;
|
|
3316
|
-
_context.next = 3;
|
|
3317
|
-
return new Response(str).arrayBuffer();
|
|
3318
|
-
case 3:
|
|
3319
|
-
_context.t1 = _context.sent;
|
|
3320
|
-
return _context.abrupt("return", new _context.t0(_context.t1));
|
|
3321
|
-
case 5:
|
|
3322
|
-
case "end":
|
|
3323
|
-
return _context.stop();
|
|
3324
|
-
}
|
|
3325
|
-
}, _callee);
|
|
3326
|
-
}));
|
|
3327
|
-
return function (_x) {
|
|
3328
|
-
return _ref.apply(this, arguments);
|
|
3353
|
+
var DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
3354
|
+
var isFunction = utils$1.isFunction;
|
|
3355
|
+
var globalFetchAPI = function (_ref) {
|
|
3356
|
+
var fetch = _ref.fetch,
|
|
3357
|
+
Request = _ref.Request,
|
|
3358
|
+
Response = _ref.Response;
|
|
3359
|
+
return {
|
|
3360
|
+
fetch: fetch,
|
|
3361
|
+
Request: Request,
|
|
3362
|
+
Response: Response
|
|
3329
3363
|
};
|
|
3330
|
-
}()
|
|
3364
|
+
}(utils$1.global);
|
|
3365
|
+
var _utils$global = utils$1.global,
|
|
3366
|
+
ReadableStream$1 = _utils$global.ReadableStream,
|
|
3367
|
+
TextEncoder = _utils$global.TextEncoder;
|
|
3331
3368
|
var test = function test(fn) {
|
|
3332
3369
|
try {
|
|
3333
3370
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
@@ -3338,232 +3375,298 @@
|
|
|
3338
3375
|
return false;
|
|
3339
3376
|
}
|
|
3340
3377
|
};
|
|
3341
|
-
var
|
|
3342
|
-
var
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
return duplexAccessed && !hasContentType;
|
|
3352
|
-
});
|
|
3353
|
-
var DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
3354
|
-
var supportsResponseStream = isReadableStreamSupported && test(function () {
|
|
3355
|
-
return utils$1.isReadableStream(new Response('').body);
|
|
3356
|
-
});
|
|
3357
|
-
var resolvers = {
|
|
3358
|
-
stream: supportsResponseStream && function (res) {
|
|
3359
|
-
return res.body;
|
|
3378
|
+
var factory = function factory(env) {
|
|
3379
|
+
var _Object$assign = Object.assign({}, globalFetchAPI, env),
|
|
3380
|
+
fetch = _Object$assign.fetch,
|
|
3381
|
+
Request = _Object$assign.Request,
|
|
3382
|
+
Response = _Object$assign.Response;
|
|
3383
|
+
var isFetchSupported = isFunction(fetch);
|
|
3384
|
+
var isRequestSupported = isFunction(Request);
|
|
3385
|
+
var isResponseSupported = isFunction(Response);
|
|
3386
|
+
if (!isFetchSupported) {
|
|
3387
|
+
return false;
|
|
3360
3388
|
}
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
body: body
|
|
3396
|
-
});
|
|
3397
|
-
_context2.next = 8;
|
|
3398
|
-
return _request.arrayBuffer();
|
|
3399
|
-
case 8:
|
|
3400
|
-
return _context2.abrupt("return", _context2.sent.byteLength);
|
|
3401
|
-
case 9:
|
|
3402
|
-
if (!(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body))) {
|
|
3403
|
-
_context2.next = 11;
|
|
3404
|
-
break;
|
|
3405
|
-
}
|
|
3406
|
-
return _context2.abrupt("return", body.byteLength);
|
|
3407
|
-
case 11:
|
|
3408
|
-
if (utils$1.isURLSearchParams(body)) {
|
|
3409
|
-
body = body + '';
|
|
3410
|
-
}
|
|
3411
|
-
if (!utils$1.isString(body)) {
|
|
3412
|
-
_context2.next = 16;
|
|
3413
|
-
break;
|
|
3414
|
-
}
|
|
3415
|
-
_context2.next = 15;
|
|
3416
|
-
return encodeText(body);
|
|
3417
|
-
case 15:
|
|
3418
|
-
return _context2.abrupt("return", _context2.sent.byteLength);
|
|
3419
|
-
case 16:
|
|
3420
|
-
case "end":
|
|
3421
|
-
return _context2.stop();
|
|
3422
|
-
}
|
|
3423
|
-
}, _callee2);
|
|
3424
|
-
}));
|
|
3425
|
-
return function getBodyLength(_x2) {
|
|
3426
|
-
return _ref2.apply(this, arguments);
|
|
3427
|
-
};
|
|
3428
|
-
}();
|
|
3429
|
-
var resolveBodyLength = /*#__PURE__*/function () {
|
|
3430
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(headers, body) {
|
|
3431
|
-
var length;
|
|
3432
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
3433
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
3434
|
-
case 0:
|
|
3435
|
-
length = utils$1.toFiniteNumber(headers.getContentLength());
|
|
3436
|
-
return _context3.abrupt("return", length == null ? getBodyLength(body) : length);
|
|
3437
|
-
case 2:
|
|
3438
|
-
case "end":
|
|
3439
|
-
return _context3.stop();
|
|
3389
|
+
var isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
|
|
3390
|
+
var encodeText = isFetchSupported && (typeof TextEncoder === 'function' ? function (encoder) {
|
|
3391
|
+
return function (str) {
|
|
3392
|
+
return encoder.encode(str);
|
|
3393
|
+
};
|
|
3394
|
+
}(new TextEncoder()) : ( /*#__PURE__*/function () {
|
|
3395
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(str) {
|
|
3396
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3397
|
+
while (1) switch (_context.prev = _context.next) {
|
|
3398
|
+
case 0:
|
|
3399
|
+
_context.t0 = Uint8Array;
|
|
3400
|
+
_context.next = 3;
|
|
3401
|
+
return new Request(str).arrayBuffer();
|
|
3402
|
+
case 3:
|
|
3403
|
+
_context.t1 = _context.sent;
|
|
3404
|
+
return _context.abrupt("return", new _context.t0(_context.t1));
|
|
3405
|
+
case 5:
|
|
3406
|
+
case "end":
|
|
3407
|
+
return _context.stop();
|
|
3408
|
+
}
|
|
3409
|
+
}, _callee);
|
|
3410
|
+
}));
|
|
3411
|
+
return function (_x) {
|
|
3412
|
+
return _ref2.apply(this, arguments);
|
|
3413
|
+
};
|
|
3414
|
+
}()));
|
|
3415
|
+
var supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(function () {
|
|
3416
|
+
var duplexAccessed = false;
|
|
3417
|
+
var hasContentType = new Request(platform.origin, {
|
|
3418
|
+
body: new ReadableStream$1(),
|
|
3419
|
+
method: 'POST',
|
|
3420
|
+
get duplex() {
|
|
3421
|
+
duplexAccessed = true;
|
|
3422
|
+
return 'half';
|
|
3440
3423
|
}
|
|
3441
|
-
}
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3424
|
+
}).headers.has('Content-Type');
|
|
3425
|
+
return duplexAccessed && !hasContentType;
|
|
3426
|
+
});
|
|
3427
|
+
var supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(function () {
|
|
3428
|
+
return utils$1.isReadableStream(new Response('').body);
|
|
3429
|
+
});
|
|
3430
|
+
var resolvers = {
|
|
3431
|
+
stream: supportsResponseStream && function (res) {
|
|
3432
|
+
return res.body;
|
|
3433
|
+
}
|
|
3445
3434
|
};
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3435
|
+
isFetchSupported && function () {
|
|
3436
|
+
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(function (type) {
|
|
3437
|
+
!resolvers[type] && (resolvers[type] = function (res, config) {
|
|
3438
|
+
var method = res && res[type];
|
|
3439
|
+
if (method) {
|
|
3440
|
+
return method.call(res);
|
|
3441
|
+
}
|
|
3442
|
+
throw new AxiosError("Response type '".concat(type, "' is not supported"), AxiosError.ERR_NOT_SUPPORT, config);
|
|
3443
|
+
});
|
|
3444
|
+
});
|
|
3445
|
+
}();
|
|
3446
|
+
var getBodyLength = /*#__PURE__*/function () {
|
|
3447
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(body) {
|
|
3448
|
+
var _request;
|
|
3449
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3450
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
3451
|
+
case 0:
|
|
3452
|
+
if (!(body == null)) {
|
|
3453
|
+
_context2.next = 2;
|
|
3454
|
+
break;
|
|
3455
|
+
}
|
|
3456
|
+
return _context2.abrupt("return", 0);
|
|
3457
|
+
case 2:
|
|
3458
|
+
if (!utils$1.isBlob(body)) {
|
|
3459
|
+
_context2.next = 4;
|
|
3460
|
+
break;
|
|
3461
|
+
}
|
|
3462
|
+
return _context2.abrupt("return", body.size);
|
|
3463
|
+
case 4:
|
|
3464
|
+
if (!utils$1.isSpecCompliantForm(body)) {
|
|
3465
|
+
_context2.next = 9;
|
|
3466
|
+
break;
|
|
3467
|
+
}
|
|
3468
|
+
_request = new Request(platform.origin, {
|
|
3469
|
+
method: 'POST',
|
|
3470
|
+
body: body
|
|
3471
|
+
});
|
|
3472
|
+
_context2.next = 8;
|
|
3473
|
+
return _request.arrayBuffer();
|
|
3474
|
+
case 8:
|
|
3475
|
+
return _context2.abrupt("return", _context2.sent.byteLength);
|
|
3476
|
+
case 9:
|
|
3477
|
+
if (!(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body))) {
|
|
3478
|
+
_context2.next = 11;
|
|
3479
|
+
break;
|
|
3480
|
+
}
|
|
3481
|
+
return _context2.abrupt("return", body.byteLength);
|
|
3482
|
+
case 11:
|
|
3483
|
+
if (utils$1.isURLSearchParams(body)) {
|
|
3484
|
+
body = body + '';
|
|
3485
|
+
}
|
|
3486
|
+
if (!utils$1.isString(body)) {
|
|
3487
|
+
_context2.next = 16;
|
|
3488
|
+
break;
|
|
3489
|
+
}
|
|
3490
|
+
_context2.next = 15;
|
|
3491
|
+
return encodeText(body);
|
|
3492
|
+
case 15:
|
|
3493
|
+
return _context2.abrupt("return", _context2.sent.byteLength);
|
|
3494
|
+
case 16:
|
|
3495
|
+
case "end":
|
|
3496
|
+
return _context2.stop();
|
|
3497
|
+
}
|
|
3498
|
+
}, _callee2);
|
|
3499
|
+
}));
|
|
3500
|
+
return function getBodyLength(_x2) {
|
|
3501
|
+
return _ref3.apply(this, arguments);
|
|
3502
|
+
};
|
|
3503
|
+
}();
|
|
3504
|
+
var resolveBodyLength = /*#__PURE__*/function () {
|
|
3505
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(headers, body) {
|
|
3506
|
+
var length;
|
|
3507
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
3508
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
3509
|
+
case 0:
|
|
3510
|
+
length = utils$1.toFiniteNumber(headers.getContentLength());
|
|
3511
|
+
return _context3.abrupt("return", length == null ? getBodyLength(body) : length);
|
|
3512
|
+
case 2:
|
|
3513
|
+
case "end":
|
|
3514
|
+
return _context3.stop();
|
|
3515
|
+
}
|
|
3516
|
+
}, _callee3);
|
|
3517
|
+
}));
|
|
3518
|
+
return function resolveBodyLength(_x3, _x4) {
|
|
3519
|
+
return _ref4.apply(this, arguments);
|
|
3520
|
+
};
|
|
3521
|
+
}();
|
|
3522
|
+
return /*#__PURE__*/function () {
|
|
3523
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(config) {
|
|
3524
|
+
var _resolveConfig, url, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, _resolveConfig$withCr, withCredentials, fetchOptions, composedSignal, request, unsubscribe, requestContentLength, _request, contentTypeHeader, _progressEventDecorat, _progressEventDecorat2, onProgress, flush, isCredentialsSupported, resolvedOptions, response, isStreamResponse, options, responseContentLength, _ref6, _ref7, _onProgress, _flush, responseData;
|
|
3525
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
3526
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
3527
|
+
case 0:
|
|
3528
|
+
_resolveConfig = resolveConfig(config), url = _resolveConfig.url, method = _resolveConfig.method, data = _resolveConfig.data, signal = _resolveConfig.signal, cancelToken = _resolveConfig.cancelToken, timeout = _resolveConfig.timeout, onDownloadProgress = _resolveConfig.onDownloadProgress, onUploadProgress = _resolveConfig.onUploadProgress, responseType = _resolveConfig.responseType, headers = _resolveConfig.headers, _resolveConfig$withCr = _resolveConfig.withCredentials, withCredentials = _resolveConfig$withCr === void 0 ? 'same-origin' : _resolveConfig$withCr, fetchOptions = _resolveConfig.fetchOptions;
|
|
3529
|
+
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
3530
|
+
composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
|
3531
|
+
request = null;
|
|
3532
|
+
unsubscribe = composedSignal && composedSignal.unsubscribe && function () {
|
|
3533
|
+
composedSignal.unsubscribe();
|
|
3534
|
+
};
|
|
3535
|
+
_context4.prev = 5;
|
|
3536
|
+
_context4.t0 = onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head';
|
|
3537
|
+
if (!_context4.t0) {
|
|
3538
|
+
_context4.next = 12;
|
|
3539
|
+
break;
|
|
3540
|
+
}
|
|
3541
|
+
_context4.next = 10;
|
|
3542
|
+
return resolveBodyLength(headers, data);
|
|
3543
|
+
case 10:
|
|
3544
|
+
_context4.t1 = requestContentLength = _context4.sent;
|
|
3545
|
+
_context4.t0 = _context4.t1 !== 0;
|
|
3546
|
+
case 12:
|
|
3547
|
+
if (!_context4.t0) {
|
|
3548
|
+
_context4.next = 16;
|
|
3549
|
+
break;
|
|
3550
|
+
}
|
|
3551
|
+
_request = new Request(url, {
|
|
3552
|
+
method: 'POST',
|
|
3553
|
+
body: data,
|
|
3554
|
+
duplex: "half"
|
|
3555
|
+
});
|
|
3556
|
+
if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
|
|
3557
|
+
headers.setContentType(contentTypeHeader);
|
|
3558
|
+
}
|
|
3559
|
+
if (_request.body) {
|
|
3560
|
+
_progressEventDecorat = progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress))), _progressEventDecorat2 = _slicedToArray(_progressEventDecorat, 2), onProgress = _progressEventDecorat2[0], flush = _progressEventDecorat2[1];
|
|
3561
|
+
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
|
|
3562
|
+
}
|
|
3563
|
+
case 16:
|
|
3564
|
+
if (!utils$1.isString(withCredentials)) {
|
|
3565
|
+
withCredentials = withCredentials ? 'include' : 'omit';
|
|
3566
|
+
}
|
|
3491
3567
|
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
}));
|
|
3503
|
-
_context4.next = 20;
|
|
3504
|
-
return fetch(request, fetchOptions);
|
|
3505
|
-
case 20:
|
|
3506
|
-
response = _context4.sent;
|
|
3507
|
-
isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
3508
|
-
if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
|
|
3509
|
-
options = {};
|
|
3510
|
-
['status', 'statusText', 'headers'].forEach(function (prop) {
|
|
3511
|
-
options[prop] = response[prop];
|
|
3568
|
+
// Cloudflare Workers throws when credentials are defined
|
|
3569
|
+
// see https://github.com/cloudflare/workerd/issues/902
|
|
3570
|
+
isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
|
|
3571
|
+
resolvedOptions = _objectSpread2(_objectSpread2({}, fetchOptions), {}, {
|
|
3572
|
+
signal: composedSignal,
|
|
3573
|
+
method: method.toUpperCase(),
|
|
3574
|
+
headers: headers.normalize().toJSON(),
|
|
3575
|
+
body: data,
|
|
3576
|
+
duplex: "half",
|
|
3577
|
+
credentials: isCredentialsSupported ? withCredentials : undefined
|
|
3512
3578
|
});
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3579
|
+
request = isRequestSupported && new Request(url, resolvedOptions);
|
|
3580
|
+
_context4.next = 22;
|
|
3581
|
+
return isRequestSupported ? fetch(request, fetchOptions) : fetch(url, resolvedOptions);
|
|
3582
|
+
case 22:
|
|
3583
|
+
response = _context4.sent;
|
|
3584
|
+
isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
3585
|
+
if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
|
|
3586
|
+
options = {};
|
|
3587
|
+
['status', 'statusText', 'headers'].forEach(function (prop) {
|
|
3588
|
+
options[prop] = response[prop];
|
|
3589
|
+
});
|
|
3590
|
+
responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
|
|
3591
|
+
_ref6 = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [], _ref7 = _slicedToArray(_ref6, 2), _onProgress = _ref7[0], _flush = _ref7[1];
|
|
3592
|
+
response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, _onProgress, function () {
|
|
3593
|
+
_flush && _flush();
|
|
3594
|
+
unsubscribe && unsubscribe();
|
|
3595
|
+
}), options);
|
|
3596
|
+
}
|
|
3597
|
+
responseType = responseType || 'text';
|
|
3598
|
+
_context4.next = 28;
|
|
3599
|
+
return resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
|
|
3600
|
+
case 28:
|
|
3601
|
+
responseData = _context4.sent;
|
|
3602
|
+
!isStreamResponse && unsubscribe && unsubscribe();
|
|
3603
|
+
_context4.next = 32;
|
|
3604
|
+
return new Promise(function (resolve, reject) {
|
|
3605
|
+
settle(resolve, reject, {
|
|
3606
|
+
data: responseData,
|
|
3607
|
+
headers: AxiosHeaders$1.from(response.headers),
|
|
3608
|
+
status: response.status,
|
|
3609
|
+
statusText: response.statusText,
|
|
3610
|
+
config: config,
|
|
3611
|
+
request: request
|
|
3612
|
+
});
|
|
3535
3613
|
});
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
}
|
|
3556
|
-
}
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
};
|
|
3561
|
-
}
|
|
3614
|
+
case 32:
|
|
3615
|
+
return _context4.abrupt("return", _context4.sent);
|
|
3616
|
+
case 35:
|
|
3617
|
+
_context4.prev = 35;
|
|
3618
|
+
_context4.t2 = _context4["catch"](5);
|
|
3619
|
+
unsubscribe && unsubscribe();
|
|
3620
|
+
if (!(_context4.t2 && _context4.t2.name === 'TypeError' && /Load failed|fetch/i.test(_context4.t2.message))) {
|
|
3621
|
+
_context4.next = 40;
|
|
3622
|
+
break;
|
|
3623
|
+
}
|
|
3624
|
+
throw Object.assign(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request), {
|
|
3625
|
+
cause: _context4.t2.cause || _context4.t2
|
|
3626
|
+
});
|
|
3627
|
+
case 40:
|
|
3628
|
+
throw AxiosError.from(_context4.t2, _context4.t2 && _context4.t2.code, config, request);
|
|
3629
|
+
case 41:
|
|
3630
|
+
case "end":
|
|
3631
|
+
return _context4.stop();
|
|
3632
|
+
}
|
|
3633
|
+
}, _callee4, null, [[5, 35]]);
|
|
3634
|
+
}));
|
|
3635
|
+
return function (_x5) {
|
|
3636
|
+
return _ref5.apply(this, arguments);
|
|
3637
|
+
};
|
|
3638
|
+
}();
|
|
3639
|
+
};
|
|
3640
|
+
var seedCache = new Map();
|
|
3641
|
+
var getFetch = function getFetch(config) {
|
|
3642
|
+
var env = utils$1.merge.call({
|
|
3643
|
+
skipUndefined: true
|
|
3644
|
+
}, globalFetchAPI, config ? config.env : null);
|
|
3645
|
+
var fetch = env.fetch,
|
|
3646
|
+
Request = env.Request,
|
|
3647
|
+
Response = env.Response;
|
|
3648
|
+
var seeds = [Request, Response, fetch];
|
|
3649
|
+
var len = seeds.length,
|
|
3650
|
+
i = len,
|
|
3651
|
+
seed,
|
|
3652
|
+
target,
|
|
3653
|
+
map = seedCache;
|
|
3654
|
+
while (i--) {
|
|
3655
|
+
seed = seeds[i];
|
|
3656
|
+
target = map.get(seed);
|
|
3657
|
+
target === undefined && map.set(seed, target = i ? new Map() : factory(env));
|
|
3658
|
+
map = target;
|
|
3659
|
+
}
|
|
3660
|
+
return target;
|
|
3661
|
+
};
|
|
3662
|
+
getFetch();
|
|
3562
3663
|
|
|
3563
3664
|
var knownAdapters = {
|
|
3564
3665
|
http: httpAdapter,
|
|
3565
3666
|
xhr: xhrAdapter,
|
|
3566
|
-
fetch:
|
|
3667
|
+
fetch: {
|
|
3668
|
+
get: getFetch
|
|
3669
|
+
}
|
|
3567
3670
|
};
|
|
3568
3671
|
utils$1.forEach(knownAdapters, function (fn, value) {
|
|
3569
3672
|
if (fn) {
|
|
@@ -3586,7 +3689,7 @@
|
|
|
3586
3689
|
return utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
3587
3690
|
};
|
|
3588
3691
|
var adapters = {
|
|
3589
|
-
getAdapter: function getAdapter(adapters) {
|
|
3692
|
+
getAdapter: function getAdapter(adapters, config) {
|
|
3590
3693
|
adapters = utils$1.isArray(adapters) ? adapters : [adapters];
|
|
3591
3694
|
var _adapters = adapters,
|
|
3592
3695
|
length = _adapters.length;
|
|
@@ -3603,7 +3706,7 @@
|
|
|
3603
3706
|
throw new AxiosError("Unknown adapter '".concat(id, "'"));
|
|
3604
3707
|
}
|
|
3605
3708
|
}
|
|
3606
|
-
if (adapter) {
|
|
3709
|
+
if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
|
|
3607
3710
|
break;
|
|
3608
3711
|
}
|
|
3609
3712
|
rejectedReasons[id || '#' + i] = adapter;
|
|
@@ -3655,7 +3758,7 @@
|
|
|
3655
3758
|
if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
|
|
3656
3759
|
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
|
3657
3760
|
}
|
|
3658
|
-
var adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
|
|
3761
|
+
var adapter = adapters.getAdapter(config.adapter || defaults$1.adapter, config);
|
|
3659
3762
|
return adapter(config).then(function onAdapterResolution(response) {
|
|
3660
3763
|
throwIfCancellationRequested(config);
|
|
3661
3764
|
|
|
@@ -3677,7 +3780,7 @@
|
|
|
3677
3780
|
});
|
|
3678
3781
|
}
|
|
3679
3782
|
|
|
3680
|
-
var VERSION = "1.
|
|
3783
|
+
var VERSION = "1.12.0";
|
|
3681
3784
|
|
|
3682
3785
|
var validators$1 = {};
|
|
3683
3786
|
|