axios 1.6.0 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of axios might be problematic. Click here for more details.
- package/CHANGELOG.md +44 -0
- package/README.md +5 -2
- package/dist/axios.js +222 -172
- package/dist/axios.js.map +1 -1
- package/dist/axios.min.js +1 -1
- package/dist/axios.min.js.map +1 -1
- package/dist/browser/axios.cjs +177 -180
- package/dist/browser/axios.cjs.map +1 -1
- package/dist/esm/axios.js +177 -180
- package/dist/esm/axios.js.map +1 -1
- package/dist/esm/axios.min.js +1 -1
- package/dist/esm/axios.min.js.map +1 -1
- package/dist/node/axios.cjs +240 -192
- package/dist/node/axios.cjs.map +1 -1
- package/index.d.cts +1 -0
- package/index.d.ts +1 -0
- package/lib/adapters/xhr.js +14 -12
- package/lib/core/mergeConfig.js +1 -0
- package/lib/env/data.js +1 -1
- package/lib/helpers/cookies.js +39 -49
- package/lib/helpers/isURLSameOrigin.js +2 -2
- package/lib/platform/browser/index.js +0 -51
- package/lib/platform/common/utils.js +47 -0
- package/lib/platform/index.js +5 -1
- package/package.json +2 -1
package/dist/node/axios.cjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
// Axios v1.6.
|
1
|
+
// Axios v1.6.2 Copyright (c) 2023 Matt Zabriskie and contributors
|
2
2
|
'use strict';
|
3
3
|
|
4
4
|
const FormData$1 = require('form-data');
|
@@ -696,7 +696,7 @@ const isAsyncFn = kindOfTest('AsyncFunction');
|
|
696
696
|
const isThenable = (thing) =>
|
697
697
|
thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
|
698
698
|
|
699
|
-
const utils = {
|
699
|
+
const utils$1 = {
|
700
700
|
isArray,
|
701
701
|
isArrayBuffer,
|
702
702
|
isBuffer,
|
@@ -778,7 +778,7 @@ function AxiosError(message, code, config, request, response) {
|
|
778
778
|
response && (this.response = response);
|
779
779
|
}
|
780
780
|
|
781
|
-
utils.inherits(AxiosError, Error, {
|
781
|
+
utils$1.inherits(AxiosError, Error, {
|
782
782
|
toJSON: function toJSON() {
|
783
783
|
return {
|
784
784
|
// Standard
|
@@ -793,7 +793,7 @@ utils.inherits(AxiosError, Error, {
|
|
793
793
|
columnNumber: this.columnNumber,
|
794
794
|
stack: this.stack,
|
795
795
|
// Axios
|
796
|
-
config: utils.toJSONObject(this.config),
|
796
|
+
config: utils$1.toJSONObject(this.config),
|
797
797
|
code: this.code,
|
798
798
|
status: this.response && this.response.status ? this.response.status : null
|
799
799
|
};
|
@@ -828,7 +828,7 @@ Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
|
|
828
828
|
AxiosError.from = (error, code, config, request, response, customProps) => {
|
829
829
|
const axiosError = Object.create(prototype$1);
|
830
830
|
|
831
|
-
utils.toFlatObject(error, axiosError, function filter(obj) {
|
831
|
+
utils$1.toFlatObject(error, axiosError, function filter(obj) {
|
832
832
|
return obj !== Error.prototype;
|
833
833
|
}, prop => {
|
834
834
|
return prop !== 'isAxiosError';
|
@@ -853,7 +853,7 @@ AxiosError.from = (error, code, config, request, response, customProps) => {
|
|
853
853
|
* @returns {boolean}
|
854
854
|
*/
|
855
855
|
function isVisitable(thing) {
|
856
|
-
return utils.isPlainObject(thing) || utils.isArray(thing);
|
856
|
+
return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
|
857
857
|
}
|
858
858
|
|
859
859
|
/**
|
@@ -864,7 +864,7 @@ function isVisitable(thing) {
|
|
864
864
|
* @returns {string} the key without the brackets.
|
865
865
|
*/
|
866
866
|
function removeBrackets(key) {
|
867
|
-
return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
|
867
|
+
return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
|
868
868
|
}
|
869
869
|
|
870
870
|
/**
|
@@ -893,10 +893,10 @@ function renderKey(path, key, dots) {
|
|
893
893
|
* @returns {boolean}
|
894
894
|
*/
|
895
895
|
function isFlatArray(arr) {
|
896
|
-
return utils.isArray(arr) && !arr.some(isVisitable);
|
896
|
+
return utils$1.isArray(arr) && !arr.some(isVisitable);
|
897
897
|
}
|
898
898
|
|
899
|
-
const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
|
899
|
+
const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
|
900
900
|
return /^is[A-Z]/.test(prop);
|
901
901
|
});
|
902
902
|
|
@@ -924,7 +924,7 @@ const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
|
|
924
924
|
* @returns
|
925
925
|
*/
|
926
926
|
function toFormData(obj, formData, options) {
|
927
|
-
if (!utils.isObject(obj)) {
|
927
|
+
if (!utils$1.isObject(obj)) {
|
928
928
|
throw new TypeError('target must be an object');
|
929
929
|
}
|
930
930
|
|
@@ -932,13 +932,13 @@ function toFormData(obj, formData, options) {
|
|
932
932
|
formData = formData || new (FormData__default["default"] || FormData)();
|
933
933
|
|
934
934
|
// eslint-disable-next-line no-param-reassign
|
935
|
-
options = utils.toFlatObject(options, {
|
935
|
+
options = utils$1.toFlatObject(options, {
|
936
936
|
metaTokens: true,
|
937
937
|
dots: false,
|
938
938
|
indexes: false
|
939
939
|
}, false, function defined(option, source) {
|
940
940
|
// eslint-disable-next-line no-eq-null,eqeqeq
|
941
|
-
return !utils.isUndefined(source[option]);
|
941
|
+
return !utils$1.isUndefined(source[option]);
|
942
942
|
});
|
943
943
|
|
944
944
|
const metaTokens = options.metaTokens;
|
@@ -947,24 +947,24 @@ function toFormData(obj, formData, options) {
|
|
947
947
|
const dots = options.dots;
|
948
948
|
const indexes = options.indexes;
|
949
949
|
const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
|
950
|
-
const useBlob = _Blob && utils.isSpecCompliantForm(formData);
|
950
|
+
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
|
951
951
|
|
952
|
-
if (!utils.isFunction(visitor)) {
|
952
|
+
if (!utils$1.isFunction(visitor)) {
|
953
953
|
throw new TypeError('visitor must be a function');
|
954
954
|
}
|
955
955
|
|
956
956
|
function convertValue(value) {
|
957
957
|
if (value === null) return '';
|
958
958
|
|
959
|
-
if (utils.isDate(value)) {
|
959
|
+
if (utils$1.isDate(value)) {
|
960
960
|
return value.toISOString();
|
961
961
|
}
|
962
962
|
|
963
|
-
if (!useBlob && utils.isBlob(value)) {
|
963
|
+
if (!useBlob && utils$1.isBlob(value)) {
|
964
964
|
throw new AxiosError('Blob is not supported. Use a Buffer instead.');
|
965
965
|
}
|
966
966
|
|
967
|
-
if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
|
967
|
+
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
|
968
968
|
return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
|
969
969
|
}
|
970
970
|
|
@@ -985,20 +985,20 @@ function toFormData(obj, formData, options) {
|
|
985
985
|
let arr = value;
|
986
986
|
|
987
987
|
if (value && !path && typeof value === 'object') {
|
988
|
-
if (utils.endsWith(key, '{}')) {
|
988
|
+
if (utils$1.endsWith(key, '{}')) {
|
989
989
|
// eslint-disable-next-line no-param-reassign
|
990
990
|
key = metaTokens ? key : key.slice(0, -2);
|
991
991
|
// eslint-disable-next-line no-param-reassign
|
992
992
|
value = JSON.stringify(value);
|
993
993
|
} else if (
|
994
|
-
(utils.isArray(value) && isFlatArray(value)) ||
|
995
|
-
((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))
|
994
|
+
(utils$1.isArray(value) && isFlatArray(value)) ||
|
995
|
+
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
|
996
996
|
)) {
|
997
997
|
// eslint-disable-next-line no-param-reassign
|
998
998
|
key = removeBrackets(key);
|
999
999
|
|
1000
1000
|
arr.forEach(function each(el, index) {
|
1001
|
-
!(utils.isUndefined(el) || el === null) && formData.append(
|
1001
|
+
!(utils$1.isUndefined(el) || el === null) && formData.append(
|
1002
1002
|
// eslint-disable-next-line no-nested-ternary
|
1003
1003
|
indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
|
1004
1004
|
convertValue(el)
|
@@ -1026,7 +1026,7 @@ function toFormData(obj, formData, options) {
|
|
1026
1026
|
});
|
1027
1027
|
|
1028
1028
|
function build(value, path) {
|
1029
|
-
if (utils.isUndefined(value)) return;
|
1029
|
+
if (utils$1.isUndefined(value)) return;
|
1030
1030
|
|
1031
1031
|
if (stack.indexOf(value) !== -1) {
|
1032
1032
|
throw Error('Circular reference detected in ' + path.join('.'));
|
@@ -1034,9 +1034,9 @@ function toFormData(obj, formData, options) {
|
|
1034
1034
|
|
1035
1035
|
stack.push(value);
|
1036
1036
|
|
1037
|
-
utils.forEach(value, function each(el, key) {
|
1038
|
-
const result = !(utils.isUndefined(el) || el === null) && visitor.call(
|
1039
|
-
formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
|
1037
|
+
utils$1.forEach(value, function each(el, key) {
|
1038
|
+
const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
|
1039
|
+
formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers
|
1040
1040
|
);
|
1041
1041
|
|
1042
1042
|
if (result === true) {
|
@@ -1047,7 +1047,7 @@ function toFormData(obj, formData, options) {
|
|
1047
1047
|
stack.pop();
|
1048
1048
|
}
|
1049
1049
|
|
1050
|
-
if (!utils.isObject(obj)) {
|
1050
|
+
if (!utils$1.isObject(obj)) {
|
1051
1051
|
throw new TypeError('data must be an object');
|
1052
1052
|
}
|
1053
1053
|
|
@@ -1151,7 +1151,7 @@ function buildURL(url, params, options) {
|
|
1151
1151
|
if (serializeFn) {
|
1152
1152
|
serializedParams = serializeFn(params, options);
|
1153
1153
|
} else {
|
1154
|
-
serializedParams = utils.isURLSearchParams(params) ?
|
1154
|
+
serializedParams = utils$1.isURLSearchParams(params) ?
|
1155
1155
|
params.toString() :
|
1156
1156
|
new AxiosURLSearchParams(params, options).toString(_encode);
|
1157
1157
|
}
|
@@ -1226,7 +1226,7 @@ class InterceptorManager {
|
|
1226
1226
|
* @returns {void}
|
1227
1227
|
*/
|
1228
1228
|
forEach(fn) {
|
1229
|
-
utils.forEach(this.handlers, function forEachHandler(h) {
|
1229
|
+
utils$1.forEach(this.handlers, function forEachHandler(h) {
|
1230
1230
|
if (h !== null) {
|
1231
1231
|
fn(h);
|
1232
1232
|
}
|
@@ -1244,7 +1244,7 @@ const transitionalDefaults = {
|
|
1244
1244
|
|
1245
1245
|
const URLSearchParams = url__default["default"].URLSearchParams;
|
1246
1246
|
|
1247
|
-
const platform = {
|
1247
|
+
const platform$1 = {
|
1248
1248
|
isNode: true,
|
1249
1249
|
classes: {
|
1250
1250
|
URLSearchParams,
|
@@ -1254,10 +1254,64 @@ const platform = {
|
|
1254
1254
|
protocols: [ 'http', 'https', 'file', 'data' ]
|
1255
1255
|
};
|
1256
1256
|
|
1257
|
+
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
|
1258
|
+
|
1259
|
+
/**
|
1260
|
+
* Determine if we're running in a standard browser environment
|
1261
|
+
*
|
1262
|
+
* This allows axios to run in a web worker, and react-native.
|
1263
|
+
* Both environments support XMLHttpRequest, but not fully standard globals.
|
1264
|
+
*
|
1265
|
+
* web workers:
|
1266
|
+
* typeof window -> undefined
|
1267
|
+
* typeof document -> undefined
|
1268
|
+
*
|
1269
|
+
* react-native:
|
1270
|
+
* navigator.product -> 'ReactNative'
|
1271
|
+
* nativescript
|
1272
|
+
* navigator.product -> 'NativeScript' or 'NS'
|
1273
|
+
*
|
1274
|
+
* @returns {boolean}
|
1275
|
+
*/
|
1276
|
+
const hasStandardBrowserEnv = (
|
1277
|
+
(product) => {
|
1278
|
+
return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
|
1279
|
+
})(typeof navigator !== 'undefined' && navigator.product);
|
1280
|
+
|
1281
|
+
/**
|
1282
|
+
* Determine if we're running in a standard browser webWorker environment
|
1283
|
+
*
|
1284
|
+
* Although the `isStandardBrowserEnv` method indicates that
|
1285
|
+
* `allows axios to run in a web worker`, the WebWorker will still be
|
1286
|
+
* filtered out due to its judgment standard
|
1287
|
+
* `typeof window !== 'undefined' && typeof document !== 'undefined'`.
|
1288
|
+
* This leads to a problem when axios post `FormData` in webWorker
|
1289
|
+
*/
|
1290
|
+
const hasStandardBrowserWebWorkerEnv = (() => {
|
1291
|
+
return (
|
1292
|
+
typeof WorkerGlobalScope !== 'undefined' &&
|
1293
|
+
// eslint-disable-next-line no-undef
|
1294
|
+
self instanceof WorkerGlobalScope &&
|
1295
|
+
typeof self.importScripts === 'function'
|
1296
|
+
);
|
1297
|
+
})();
|
1298
|
+
|
1299
|
+
const utils = /*#__PURE__*/Object.freeze({
|
1300
|
+
__proto__: null,
|
1301
|
+
hasBrowserEnv: hasBrowserEnv,
|
1302
|
+
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
|
1303
|
+
hasStandardBrowserEnv: hasStandardBrowserEnv
|
1304
|
+
});
|
1305
|
+
|
1306
|
+
const platform = {
|
1307
|
+
...utils,
|
1308
|
+
...platform$1
|
1309
|
+
};
|
1310
|
+
|
1257
1311
|
function toURLEncodedForm(data, options) {
|
1258
1312
|
return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
|
1259
1313
|
visitor: function(value, key, path, helpers) {
|
1260
|
-
if (utils.isBuffer(value)) {
|
1314
|
+
if (platform.isNode && utils$1.isBuffer(value)) {
|
1261
1315
|
this.append(key, value.toString('base64'));
|
1262
1316
|
return false;
|
1263
1317
|
}
|
@@ -1279,7 +1333,7 @@ function parsePropPath(name) {
|
|
1279
1333
|
// foo.x.y.z
|
1280
1334
|
// foo-x-y-z
|
1281
1335
|
// foo x y z
|
1282
|
-
return utils.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
|
1336
|
+
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
|
1283
1337
|
return match[0] === '[]' ? '' : match[1] || match[0];
|
1284
1338
|
});
|
1285
1339
|
}
|
@@ -1316,10 +1370,10 @@ function formDataToJSON(formData) {
|
|
1316
1370
|
let name = path[index++];
|
1317
1371
|
const isNumericKey = Number.isFinite(+name);
|
1318
1372
|
const isLast = index >= path.length;
|
1319
|
-
name = !name && utils.isArray(target) ? target.length : name;
|
1373
|
+
name = !name && utils$1.isArray(target) ? target.length : name;
|
1320
1374
|
|
1321
1375
|
if (isLast) {
|
1322
|
-
if (utils.hasOwnProp(target, name)) {
|
1376
|
+
if (utils$1.hasOwnProp(target, name)) {
|
1323
1377
|
target[name] = [target[name], value];
|
1324
1378
|
} else {
|
1325
1379
|
target[name] = value;
|
@@ -1328,23 +1382,23 @@ function formDataToJSON(formData) {
|
|
1328
1382
|
return !isNumericKey;
|
1329
1383
|
}
|
1330
1384
|
|
1331
|
-
if (!target[name] || !utils.isObject(target[name])) {
|
1385
|
+
if (!target[name] || !utils$1.isObject(target[name])) {
|
1332
1386
|
target[name] = [];
|
1333
1387
|
}
|
1334
1388
|
|
1335
1389
|
const result = buildPath(path, value, target[name], index);
|
1336
1390
|
|
1337
|
-
if (result && utils.isArray(target[name])) {
|
1391
|
+
if (result && utils$1.isArray(target[name])) {
|
1338
1392
|
target[name] = arrayToObject(target[name]);
|
1339
1393
|
}
|
1340
1394
|
|
1341
1395
|
return !isNumericKey;
|
1342
1396
|
}
|
1343
1397
|
|
1344
|
-
if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
|
1398
|
+
if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
|
1345
1399
|
const obj = {};
|
1346
1400
|
|
1347
|
-
utils.forEachEntry(formData, (name, value) => {
|
1401
|
+
utils$1.forEachEntry(formData, (name, value) => {
|
1348
1402
|
buildPath(parsePropPath(name), value, obj, 0);
|
1349
1403
|
});
|
1350
1404
|
|
@@ -1365,10 +1419,10 @@ function formDataToJSON(formData) {
|
|
1365
1419
|
* @returns {string} A stringified version of the rawValue.
|
1366
1420
|
*/
|
1367
1421
|
function stringifySafely(rawValue, parser, encoder) {
|
1368
|
-
if (utils.isString(rawValue)) {
|
1422
|
+
if (utils$1.isString(rawValue)) {
|
1369
1423
|
try {
|
1370
1424
|
(parser || JSON.parse)(rawValue);
|
1371
|
-
return utils.trim(rawValue);
|
1425
|
+
return utils$1.trim(rawValue);
|
1372
1426
|
} catch (e) {
|
1373
1427
|
if (e.name !== 'SyntaxError') {
|
1374
1428
|
throw e;
|
@@ -1388,13 +1442,13 @@ const defaults = {
|
|
1388
1442
|
transformRequest: [function transformRequest(data, headers) {
|
1389
1443
|
const contentType = headers.getContentType() || '';
|
1390
1444
|
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
1391
|
-
const isObjectPayload = utils.isObject(data);
|
1445
|
+
const isObjectPayload = utils$1.isObject(data);
|
1392
1446
|
|
1393
|
-
if (isObjectPayload && utils.isHTMLForm(data)) {
|
1447
|
+
if (isObjectPayload && utils$1.isHTMLForm(data)) {
|
1394
1448
|
data = new FormData(data);
|
1395
1449
|
}
|
1396
1450
|
|
1397
|
-
const isFormData = utils.isFormData(data);
|
1451
|
+
const isFormData = utils$1.isFormData(data);
|
1398
1452
|
|
1399
1453
|
if (isFormData) {
|
1400
1454
|
if (!hasJSONContentType) {
|
@@ -1403,18 +1457,18 @@ const defaults = {
|
|
1403
1457
|
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
1404
1458
|
}
|
1405
1459
|
|
1406
|
-
if (utils.isArrayBuffer(data) ||
|
1407
|
-
utils.isBuffer(data) ||
|
1408
|
-
utils.isStream(data) ||
|
1409
|
-
utils.isFile(data) ||
|
1410
|
-
utils.isBlob(data)
|
1460
|
+
if (utils$1.isArrayBuffer(data) ||
|
1461
|
+
utils$1.isBuffer(data) ||
|
1462
|
+
utils$1.isStream(data) ||
|
1463
|
+
utils$1.isFile(data) ||
|
1464
|
+
utils$1.isBlob(data)
|
1411
1465
|
) {
|
1412
1466
|
return data;
|
1413
1467
|
}
|
1414
|
-
if (utils.isArrayBufferView(data)) {
|
1468
|
+
if (utils$1.isArrayBufferView(data)) {
|
1415
1469
|
return data.buffer;
|
1416
1470
|
}
|
1417
|
-
if (utils.isURLSearchParams(data)) {
|
1471
|
+
if (utils$1.isURLSearchParams(data)) {
|
1418
1472
|
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
1419
1473
|
return data.toString();
|
1420
1474
|
}
|
@@ -1426,7 +1480,7 @@ const defaults = {
|
|
1426
1480
|
return toURLEncodedForm(data, this.formSerializer).toString();
|
1427
1481
|
}
|
1428
1482
|
|
1429
|
-
if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
|
1483
|
+
if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
|
1430
1484
|
const _FormData = this.env && this.env.FormData;
|
1431
1485
|
|
1432
1486
|
return toFormData(
|
@@ -1450,7 +1504,7 @@ const defaults = {
|
|
1450
1504
|
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
1451
1505
|
const JSONRequested = this.responseType === 'json';
|
1452
1506
|
|
1453
|
-
if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
|
1507
|
+
if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
|
1454
1508
|
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
1455
1509
|
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
1456
1510
|
|
@@ -1498,7 +1552,7 @@ const defaults = {
|
|
1498
1552
|
}
|
1499
1553
|
};
|
1500
1554
|
|
1501
|
-
utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
|
1555
|
+
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
|
1502
1556
|
defaults.headers[method] = {};
|
1503
1557
|
});
|
1504
1558
|
|
@@ -1506,7 +1560,7 @@ const defaults$1 = defaults;
|
|
1506
1560
|
|
1507
1561
|
// RawAxiosHeaders whose duplicates are ignored by node
|
1508
1562
|
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
1509
|
-
const ignoreDuplicateOf = utils.toObjectSet([
|
1563
|
+
const ignoreDuplicateOf = utils$1.toObjectSet([
|
1510
1564
|
'age', 'authorization', 'content-length', 'content-type', 'etag',
|
1511
1565
|
'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
|
1512
1566
|
'last-modified', 'location', 'max-forwards', 'proxy-authorization',
|
@@ -1567,7 +1621,7 @@ function normalizeValue(value) {
|
|
1567
1621
|
return value;
|
1568
1622
|
}
|
1569
1623
|
|
1570
|
-
return utils.isArray(value) ? value.map(normalizeValue) : String(value);
|
1624
|
+
return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
|
1571
1625
|
}
|
1572
1626
|
|
1573
1627
|
function parseTokens(str) {
|
@@ -1585,7 +1639,7 @@ function parseTokens(str) {
|
|
1585
1639
|
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
1586
1640
|
|
1587
1641
|
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
1588
|
-
if (utils.isFunction(filter)) {
|
1642
|
+
if (utils$1.isFunction(filter)) {
|
1589
1643
|
return filter.call(this, value, header);
|
1590
1644
|
}
|
1591
1645
|
|
@@ -1593,13 +1647,13 @@ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
1593
1647
|
value = header;
|
1594
1648
|
}
|
1595
1649
|
|
1596
|
-
if (!utils.isString(value)) return;
|
1650
|
+
if (!utils$1.isString(value)) return;
|
1597
1651
|
|
1598
|
-
if (utils.isString(filter)) {
|
1652
|
+
if (utils$1.isString(filter)) {
|
1599
1653
|
return value.indexOf(filter) !== -1;
|
1600
1654
|
}
|
1601
1655
|
|
1602
|
-
if (utils.isRegExp(filter)) {
|
1656
|
+
if (utils$1.isRegExp(filter)) {
|
1603
1657
|
return filter.test(value);
|
1604
1658
|
}
|
1605
1659
|
}
|
@@ -1612,7 +1666,7 @@ function formatHeader(header) {
|
|
1612
1666
|
}
|
1613
1667
|
|
1614
1668
|
function buildAccessors(obj, header) {
|
1615
|
-
const accessorName = utils.toCamelCase(' ' + header);
|
1669
|
+
const accessorName = utils$1.toCamelCase(' ' + header);
|
1616
1670
|
|
1617
1671
|
['get', 'set', 'has'].forEach(methodName => {
|
1618
1672
|
Object.defineProperty(obj, methodName + accessorName, {
|
@@ -1639,7 +1693,7 @@ class AxiosHeaders {
|
|
1639
1693
|
throw new Error('header name must be a non-empty string');
|
1640
1694
|
}
|
1641
1695
|
|
1642
|
-
const key = utils.findKey(self, lHeader);
|
1696
|
+
const key = utils$1.findKey(self, lHeader);
|
1643
1697
|
|
1644
1698
|
if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
|
1645
1699
|
self[key || _header] = normalizeValue(_value);
|
@@ -1647,11 +1701,11 @@ class AxiosHeaders {
|
|
1647
1701
|
}
|
1648
1702
|
|
1649
1703
|
const setHeaders = (headers, _rewrite) =>
|
1650
|
-
utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
1704
|
+
utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
1651
1705
|
|
1652
|
-
if (utils.isPlainObject(header) || header instanceof this.constructor) {
|
1706
|
+
if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
|
1653
1707
|
setHeaders(header, valueOrRewrite);
|
1654
|
-
} else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
1708
|
+
} else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
1655
1709
|
setHeaders(parseHeaders(header), valueOrRewrite);
|
1656
1710
|
} else {
|
1657
1711
|
header != null && setHeader(valueOrRewrite, header, rewrite);
|
@@ -1664,7 +1718,7 @@ class AxiosHeaders {
|
|
1664
1718
|
header = normalizeHeader(header);
|
1665
1719
|
|
1666
1720
|
if (header) {
|
1667
|
-
const key = utils.findKey(this, header);
|
1721
|
+
const key = utils$1.findKey(this, header);
|
1668
1722
|
|
1669
1723
|
if (key) {
|
1670
1724
|
const value = this[key];
|
@@ -1677,11 +1731,11 @@ class AxiosHeaders {
|
|
1677
1731
|
return parseTokens(value);
|
1678
1732
|
}
|
1679
1733
|
|
1680
|
-
if (utils.isFunction(parser)) {
|
1734
|
+
if (utils$1.isFunction(parser)) {
|
1681
1735
|
return parser.call(this, value, key);
|
1682
1736
|
}
|
1683
1737
|
|
1684
|
-
if (utils.isRegExp(parser)) {
|
1738
|
+
if (utils$1.isRegExp(parser)) {
|
1685
1739
|
return parser.exec(value);
|
1686
1740
|
}
|
1687
1741
|
|
@@ -1694,7 +1748,7 @@ class AxiosHeaders {
|
|
1694
1748
|
header = normalizeHeader(header);
|
1695
1749
|
|
1696
1750
|
if (header) {
|
1697
|
-
const key = utils.findKey(this, header);
|
1751
|
+
const key = utils$1.findKey(this, header);
|
1698
1752
|
|
1699
1753
|
return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
1700
1754
|
}
|
@@ -1710,7 +1764,7 @@ class AxiosHeaders {
|
|
1710
1764
|
_header = normalizeHeader(_header);
|
1711
1765
|
|
1712
1766
|
if (_header) {
|
1713
|
-
const key = utils.findKey(self, _header);
|
1767
|
+
const key = utils$1.findKey(self, _header);
|
1714
1768
|
|
1715
1769
|
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
|
1716
1770
|
delete self[key];
|
@@ -1720,7 +1774,7 @@ class AxiosHeaders {
|
|
1720
1774
|
}
|
1721
1775
|
}
|
1722
1776
|
|
1723
|
-
if (utils.isArray(header)) {
|
1777
|
+
if (utils$1.isArray(header)) {
|
1724
1778
|
header.forEach(deleteHeader);
|
1725
1779
|
} else {
|
1726
1780
|
deleteHeader(header);
|
@@ -1749,8 +1803,8 @@ class AxiosHeaders {
|
|
1749
1803
|
const self = this;
|
1750
1804
|
const headers = {};
|
1751
1805
|
|
1752
|
-
utils.forEach(this, (value, header) => {
|
1753
|
-
const key = utils.findKey(headers, header);
|
1806
|
+
utils$1.forEach(this, (value, header) => {
|
1807
|
+
const key = utils$1.findKey(headers, header);
|
1754
1808
|
|
1755
1809
|
if (key) {
|
1756
1810
|
self[key] = normalizeValue(value);
|
@@ -1779,8 +1833,8 @@ class AxiosHeaders {
|
|
1779
1833
|
toJSON(asStrings) {
|
1780
1834
|
const obj = Object.create(null);
|
1781
1835
|
|
1782
|
-
utils.forEach(this, (value, header) => {
|
1783
|
-
value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);
|
1836
|
+
utils$1.forEach(this, (value, header) => {
|
1837
|
+
value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
|
1784
1838
|
});
|
1785
1839
|
|
1786
1840
|
return obj;
|
@@ -1827,7 +1881,7 @@ class AxiosHeaders {
|
|
1827
1881
|
}
|
1828
1882
|
}
|
1829
1883
|
|
1830
|
-
utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
1884
|
+
utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
1831
1885
|
|
1832
1886
|
return this;
|
1833
1887
|
}
|
@@ -1836,7 +1890,7 @@ class AxiosHeaders {
|
|
1836
1890
|
AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
|
1837
1891
|
|
1838
1892
|
// reserved names hotfix
|
1839
|
-
utils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
|
1893
|
+
utils$1.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
|
1840
1894
|
let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
|
1841
1895
|
return {
|
1842
1896
|
get: () => value,
|
@@ -1846,7 +1900,7 @@ utils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
|
|
1846
1900
|
}
|
1847
1901
|
});
|
1848
1902
|
|
1849
|
-
utils.freezeMethods(AxiosHeaders);
|
1903
|
+
utils$1.freezeMethods(AxiosHeaders);
|
1850
1904
|
|
1851
1905
|
const AxiosHeaders$1 = AxiosHeaders;
|
1852
1906
|
|
@@ -1864,7 +1918,7 @@ function transformData(fns, response) {
|
|
1864
1918
|
const headers = AxiosHeaders$1.from(context.headers);
|
1865
1919
|
let data = context.data;
|
1866
1920
|
|
1867
|
-
utils.forEach(fns, function transform(fn) {
|
1921
|
+
utils$1.forEach(fns, function transform(fn) {
|
1868
1922
|
data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
|
1869
1923
|
});
|
1870
1924
|
|
@@ -1892,7 +1946,7 @@ function CanceledError(message, config, request) {
|
|
1892
1946
|
this.name = 'CanceledError';
|
1893
1947
|
}
|
1894
1948
|
|
1895
|
-
utils.inherits(CanceledError, AxiosError, {
|
1949
|
+
utils$1.inherits(CanceledError, AxiosError, {
|
1896
1950
|
__CANCEL__: true
|
1897
1951
|
});
|
1898
1952
|
|
@@ -1965,7 +2019,7 @@ function buildFullPath(baseURL, requestedURL) {
|
|
1965
2019
|
return requestedURL;
|
1966
2020
|
}
|
1967
2021
|
|
1968
|
-
const VERSION = "1.6.
|
2022
|
+
const VERSION = "1.6.2";
|
1969
2023
|
|
1970
2024
|
function parseProtocol(url) {
|
1971
2025
|
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
@@ -2106,7 +2160,7 @@ const kInternals = Symbol('internals');
|
|
2106
2160
|
|
2107
2161
|
class AxiosTransformStream extends stream__default["default"].Transform{
|
2108
2162
|
constructor(options) {
|
2109
|
-
options = utils.toFlatObject(options, {
|
2163
|
+
options = utils$1.toFlatObject(options, {
|
2110
2164
|
maxRate: 0,
|
2111
2165
|
chunkSize: 64 * 1024,
|
2112
2166
|
minChunkSize: 100,
|
@@ -2114,7 +2168,7 @@ class AxiosTransformStream extends stream__default["default"].Transform{
|
|
2114
2168
|
ticksRate: 2,
|
2115
2169
|
samplesCount: 15
|
2116
2170
|
}, null, (prop, source) => {
|
2117
|
-
return !utils.isUndefined(source[prop]);
|
2171
|
+
return !utils$1.isUndefined(source[prop]);
|
2118
2172
|
});
|
2119
2173
|
|
2120
2174
|
super({
|
@@ -2303,7 +2357,7 @@ const readBlob = async function* (blob) {
|
|
2303
2357
|
|
2304
2358
|
const readBlob$1 = readBlob;
|
2305
2359
|
|
2306
|
-
const BOUNDARY_ALPHABET = utils.ALPHABET.ALPHA_DIGIT + '-_';
|
2360
|
+
const BOUNDARY_ALPHABET = utils$1.ALPHABET.ALPHA_DIGIT + '-_';
|
2307
2361
|
|
2308
2362
|
const textEncoder = new util.TextEncoder();
|
2309
2363
|
|
@@ -2314,7 +2368,7 @@ const CRLF_BYTES_COUNT = 2;
|
|
2314
2368
|
class FormDataPart {
|
2315
2369
|
constructor(name, value) {
|
2316
2370
|
const {escapeName} = this.constructor;
|
2317
|
-
const isStringValue = utils.isString(value);
|
2371
|
+
const isStringValue = utils$1.isString(value);
|
2318
2372
|
|
2319
2373
|
let headers = `Content-Disposition: form-data; name="${escapeName(name)}"${
|
2320
2374
|
!isStringValue && value.name ? `; filename="${escapeName(value.name)}"` : ''
|
@@ -2341,7 +2395,7 @@ class FormDataPart {
|
|
2341
2395
|
|
2342
2396
|
const {value} = this;
|
2343
2397
|
|
2344
|
-
if(utils.isTypedArray(value)) {
|
2398
|
+
if(utils$1.isTypedArray(value)) {
|
2345
2399
|
yield value;
|
2346
2400
|
} else {
|
2347
2401
|
yield* readBlob$1(value);
|
@@ -2363,10 +2417,10 @@ const formDataToStream = (form, headersHandler, options) => {
|
|
2363
2417
|
const {
|
2364
2418
|
tag = 'form-data-boundary',
|
2365
2419
|
size = 25,
|
2366
|
-
boundary = tag + '-' + utils.generateString(size, BOUNDARY_ALPHABET)
|
2420
|
+
boundary = tag + '-' + utils$1.generateString(size, BOUNDARY_ALPHABET)
|
2367
2421
|
} = options || {};
|
2368
2422
|
|
2369
|
-
if(!utils.isFormData(form)) {
|
2423
|
+
if(!utils$1.isFormData(form)) {
|
2370
2424
|
throw TypeError('FormData instance required');
|
2371
2425
|
}
|
2372
2426
|
|
@@ -2386,7 +2440,7 @@ const formDataToStream = (form, headersHandler, options) => {
|
|
2386
2440
|
|
2387
2441
|
contentLength += boundaryBytes.byteLength * parts.length;
|
2388
2442
|
|
2389
|
-
contentLength = utils.toFiniteNumber(contentLength);
|
2443
|
+
contentLength = utils$1.toFiniteNumber(contentLength);
|
2390
2444
|
|
2391
2445
|
const computedHeaders = {
|
2392
2446
|
'Content-Type': `multipart/form-data; boundary=${boundary}`
|
@@ -2436,7 +2490,7 @@ class ZlibHeaderTransformStream extends stream__default["default"].Transform {
|
|
2436
2490
|
const ZlibHeaderTransformStream$1 = ZlibHeaderTransformStream;
|
2437
2491
|
|
2438
2492
|
const callbackify = (fn, reducer) => {
|
2439
|
-
return utils.isAsyncFn(fn) ? function (...args) {
|
2493
|
+
return utils$1.isAsyncFn(fn) ? function (...args) {
|
2440
2494
|
const cb = args.pop();
|
2441
2495
|
fn.apply(this, args).then((value) => {
|
2442
2496
|
try {
|
@@ -2460,7 +2514,7 @@ const brotliOptions = {
|
|
2460
2514
|
finishFlush: zlib__default["default"].constants.BROTLI_OPERATION_FLUSH
|
2461
2515
|
};
|
2462
2516
|
|
2463
|
-
const isBrotliSupported = utils.isFunction(zlib__default["default"].createBrotliDecompress);
|
2517
|
+
const isBrotliSupported = utils$1.isFunction(zlib__default["default"].createBrotliDecompress);
|
2464
2518
|
|
2465
2519
|
const {http: httpFollow, https: httpsFollow} = followRedirects__default["default"];
|
2466
2520
|
|
@@ -2540,7 +2594,7 @@ function setProxy(options, configProxy, location) {
|
|
2540
2594
|
};
|
2541
2595
|
}
|
2542
2596
|
|
2543
|
-
const isHttpAdapterSupported = typeof process !== 'undefined' && utils.kindOf(process) === 'process';
|
2597
|
+
const isHttpAdapterSupported = typeof process !== 'undefined' && utils$1.kindOf(process) === 'process';
|
2544
2598
|
|
2545
2599
|
// temporary hotfix
|
2546
2600
|
|
@@ -2570,7 +2624,7 @@ const wrapAsync = (asyncExecutor) => {
|
|
2570
2624
|
};
|
2571
2625
|
|
2572
2626
|
const resolveFamily = ({address, family}) => {
|
2573
|
-
if (!utils.isString(address)) {
|
2627
|
+
if (!utils$1.isString(address)) {
|
2574
2628
|
throw TypeError('address must be a string');
|
2575
2629
|
}
|
2576
2630
|
return ({
|
@@ -2579,7 +2633,7 @@ const resolveFamily = ({address, family}) => {
|
|
2579
2633
|
});
|
2580
2634
|
};
|
2581
2635
|
|
2582
|
-
const buildAddressEntry = (address, family) => resolveFamily(utils.isObject(address) ? address : {address, family});
|
2636
|
+
const buildAddressEntry = (address, family) => resolveFamily(utils$1.isObject(address) ? address : {address, family});
|
2583
2637
|
|
2584
2638
|
/*eslint consistent-return:0*/
|
2585
2639
|
const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
@@ -2592,11 +2646,11 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
2592
2646
|
let req;
|
2593
2647
|
|
2594
2648
|
if (lookup) {
|
2595
|
-
const _lookup = callbackify$1(lookup, (value) => utils.isArray(value) ? value : [value]);
|
2649
|
+
const _lookup = callbackify$1(lookup, (value) => utils$1.isArray(value) ? value : [value]);
|
2596
2650
|
// hotfix to support opt.all option which is required for node 20.x
|
2597
2651
|
lookup = (hostname, opt, cb) => {
|
2598
2652
|
_lookup(hostname, opt, (err, arg0, arg1) => {
|
2599
|
-
const addresses = utils.isArray(arg0) ? arg0.map(addr => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
|
2653
|
+
const addresses = utils$1.isArray(arg0) ? arg0.map(addr => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
|
2600
2654
|
|
2601
2655
|
opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
|
2602
2656
|
});
|
@@ -2668,7 +2722,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
2668
2722
|
convertedData = convertedData.toString(responseEncoding);
|
2669
2723
|
|
2670
2724
|
if (!responseEncoding || responseEncoding === 'utf8') {
|
2671
|
-
convertedData = utils.stripBOM(convertedData);
|
2725
|
+
convertedData = utils$1.stripBOM(convertedData);
|
2672
2726
|
}
|
2673
2727
|
} else if (responseType === 'stream') {
|
2674
2728
|
convertedData = stream__default["default"].Readable.from(convertedData);
|
@@ -2706,7 +2760,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
2706
2760
|
let maxDownloadRate = undefined;
|
2707
2761
|
|
2708
2762
|
// support for spec compliant FormData objects
|
2709
|
-
if (utils.isSpecCompliantForm(data)) {
|
2763
|
+
if (utils$1.isSpecCompliantForm(data)) {
|
2710
2764
|
const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i);
|
2711
2765
|
|
2712
2766
|
data = formDataToStream$1(data, (formHeaders) => {
|
@@ -2716,7 +2770,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
2716
2770
|
boundary: userBoundary && userBoundary[1] || undefined
|
2717
2771
|
});
|
2718
2772
|
// support for https://www.npmjs.com/package/form-data api
|
2719
|
-
} else if (utils.isFormData(data) && utils.isFunction(data.getHeaders)) {
|
2773
|
+
} else if (utils$1.isFormData(data) && utils$1.isFunction(data.getHeaders)) {
|
2720
2774
|
headers.set(data.getHeaders());
|
2721
2775
|
|
2722
2776
|
if (!headers.hasContentLength()) {
|
@@ -2727,14 +2781,14 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
2727
2781
|
} catch (e) {
|
2728
2782
|
}
|
2729
2783
|
}
|
2730
|
-
} else if (utils.isBlob(data)) {
|
2784
|
+
} else if (utils$1.isBlob(data)) {
|
2731
2785
|
data.size && headers.setContentType(data.type || 'application/octet-stream');
|
2732
2786
|
headers.setContentLength(data.size || 0);
|
2733
2787
|
data = stream__default["default"].Readable.from(readBlob$1(data));
|
2734
|
-
} else if (data && !utils.isStream(data)) {
|
2735
|
-
if (Buffer.isBuffer(data)) ; else if (utils.isArrayBuffer(data)) {
|
2788
|
+
} else if (data && !utils$1.isStream(data)) {
|
2789
|
+
if (Buffer.isBuffer(data)) ; else if (utils$1.isArrayBuffer(data)) {
|
2736
2790
|
data = Buffer.from(new Uint8Array(data));
|
2737
|
-
} else if (utils.isString(data)) {
|
2791
|
+
} else if (utils$1.isString(data)) {
|
2738
2792
|
data = Buffer.from(data, 'utf-8');
|
2739
2793
|
} else {
|
2740
2794
|
return reject(new AxiosError(
|
@@ -2756,9 +2810,9 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
2756
2810
|
}
|
2757
2811
|
}
|
2758
2812
|
|
2759
|
-
const contentLength = utils.toFiniteNumber(headers.getContentLength());
|
2813
|
+
const contentLength = utils$1.toFiniteNumber(headers.getContentLength());
|
2760
2814
|
|
2761
|
-
if (utils.isArray(maxRate)) {
|
2815
|
+
if (utils$1.isArray(maxRate)) {
|
2762
2816
|
maxUploadRate = maxRate[0];
|
2763
2817
|
maxDownloadRate = maxRate[1];
|
2764
2818
|
} else {
|
@@ -2766,14 +2820,14 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
2766
2820
|
}
|
2767
2821
|
|
2768
2822
|
if (data && (onUploadProgress || maxUploadRate)) {
|
2769
|
-
if (!utils.isStream(data)) {
|
2823
|
+
if (!utils$1.isStream(data)) {
|
2770
2824
|
data = stream__default["default"].Readable.from(data, {objectMode: false});
|
2771
2825
|
}
|
2772
2826
|
|
2773
2827
|
data = stream__default["default"].pipeline([data, new AxiosTransformStream$1({
|
2774
2828
|
length: contentLength,
|
2775
|
-
maxRate: utils.toFiniteNumber(maxUploadRate)
|
2776
|
-
})], utils.noop);
|
2829
|
+
maxRate: utils$1.toFiniteNumber(maxUploadRate)
|
2830
|
+
})], utils$1.noop);
|
2777
2831
|
|
2778
2832
|
onUploadProgress && data.on('progress', progress => {
|
2779
2833
|
onUploadProgress(Object.assign(progress, {
|
@@ -2832,7 +2886,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
2832
2886
|
};
|
2833
2887
|
|
2834
2888
|
// cacheable-lookup integration hotfix
|
2835
|
-
!utils.isUndefined(lookup) && (options.lookup = lookup);
|
2889
|
+
!utils$1.isUndefined(lookup) && (options.lookup = lookup);
|
2836
2890
|
|
2837
2891
|
if (config.socketPath) {
|
2838
2892
|
options.socketPath = config.socketPath;
|
@@ -2880,8 +2934,8 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
2880
2934
|
|
2881
2935
|
if (onDownloadProgress) {
|
2882
2936
|
const transformStream = new AxiosTransformStream$1({
|
2883
|
-
length: utils.toFiniteNumber(responseLength),
|
2884
|
-
maxRate: utils.toFiniteNumber(maxDownloadRate)
|
2937
|
+
length: utils$1.toFiniteNumber(responseLength),
|
2938
|
+
maxRate: utils$1.toFiniteNumber(maxDownloadRate)
|
2885
2939
|
});
|
2886
2940
|
|
2887
2941
|
onDownloadProgress && transformStream.on('progress', progress => {
|
@@ -2936,7 +2990,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
2936
2990
|
}
|
2937
2991
|
}
|
2938
2992
|
|
2939
|
-
responseStream = streams.length > 1 ? stream__default["default"].pipeline(streams, utils.noop) : streams[0];
|
2993
|
+
responseStream = streams.length > 1 ? stream__default["default"].pipeline(streams, utils$1.noop) : streams[0];
|
2940
2994
|
|
2941
2995
|
const offListeners = stream__default["default"].finished(responseStream, () => {
|
2942
2996
|
offListeners();
|
@@ -2998,7 +3052,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
2998
3052
|
if (responseType !== 'arraybuffer') {
|
2999
3053
|
responseData = responseData.toString(responseEncoding);
|
3000
3054
|
if (!responseEncoding || responseEncoding === 'utf8') {
|
3001
|
-
responseData = utils.stripBOM(responseData);
|
3055
|
+
responseData = utils$1.stripBOM(responseData);
|
3002
3056
|
}
|
3003
3057
|
}
|
3004
3058
|
response.data = responseData;
|
@@ -3075,7 +3129,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
3075
3129
|
|
3076
3130
|
|
3077
3131
|
// Send the request
|
3078
|
-
if (utils.isStream(data)) {
|
3132
|
+
if (utils$1.isStream(data)) {
|
3079
3133
|
let ended = false;
|
3080
3134
|
let errored = false;
|
3081
3135
|
|
@@ -3101,55 +3155,46 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
3101
3155
|
});
|
3102
3156
|
};
|
3103
3157
|
|
3104
|
-
const cookies = platform.
|
3158
|
+
const cookies = platform.hasStandardBrowserEnv ?
|
3105
3159
|
|
3106
|
-
// Standard browser envs support document.cookie
|
3107
|
-
|
3108
|
-
|
3109
|
-
|
3110
|
-
const cookie = [];
|
3111
|
-
cookie.push(name + '=' + encodeURIComponent(value));
|
3160
|
+
// Standard browser envs support document.cookie
|
3161
|
+
{
|
3162
|
+
write(name, value, expires, path, domain, secure) {
|
3163
|
+
const cookie = [name + '=' + encodeURIComponent(value)];
|
3112
3164
|
|
3113
|
-
|
3114
|
-
cookie.push('expires=' + new Date(expires).toGMTString());
|
3115
|
-
}
|
3165
|
+
utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
|
3116
3166
|
|
3117
|
-
|
3118
|
-
cookie.push('path=' + path);
|
3119
|
-
}
|
3167
|
+
utils$1.isString(path) && cookie.push('path=' + path);
|
3120
3168
|
|
3121
|
-
|
3122
|
-
cookie.push('domain=' + domain);
|
3123
|
-
}
|
3169
|
+
utils$1.isString(domain) && cookie.push('domain=' + domain);
|
3124
3170
|
|
3125
|
-
|
3126
|
-
cookie.push('secure');
|
3127
|
-
}
|
3171
|
+
secure === true && cookie.push('secure');
|
3128
3172
|
|
3129
|
-
|
3130
|
-
|
3173
|
+
document.cookie = cookie.join('; ');
|
3174
|
+
},
|
3131
3175
|
|
3132
|
-
|
3133
|
-
|
3134
|
-
|
3135
|
-
|
3176
|
+
read(name) {
|
3177
|
+
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
3178
|
+
return (match ? decodeURIComponent(match[3]) : null);
|
3179
|
+
},
|
3136
3180
|
|
3137
|
-
|
3138
|
-
|
3139
|
-
|
3140
|
-
|
3141
|
-
})() :
|
3181
|
+
remove(name) {
|
3182
|
+
this.write(name, '', Date.now() - 86400000);
|
3183
|
+
}
|
3184
|
+
}
|
3142
3185
|
|
3143
|
-
|
3144
|
-
|
3145
|
-
|
3146
|
-
|
3147
|
-
|
3148
|
-
|
3149
|
-
|
3150
|
-
|
3186
|
+
:
|
3187
|
+
|
3188
|
+
// Non-standard browser env (web workers, react-native) lack needed support.
|
3189
|
+
{
|
3190
|
+
write() {},
|
3191
|
+
read() {
|
3192
|
+
return null;
|
3193
|
+
},
|
3194
|
+
remove() {}
|
3195
|
+
};
|
3151
3196
|
|
3152
|
-
const isURLSameOrigin = platform.
|
3197
|
+
const isURLSameOrigin = platform.hasStandardBrowserEnv ?
|
3153
3198
|
|
3154
3199
|
// Standard browser envs have full support of the APIs needed to test
|
3155
3200
|
// whether the request URL is of the same origin as current location.
|
@@ -3159,7 +3204,7 @@ const isURLSameOrigin = platform.isStandardBrowserEnv ?
|
|
3159
3204
|
let originURL;
|
3160
3205
|
|
3161
3206
|
/**
|
3162
|
-
* Parse a URL to discover
|
3207
|
+
* Parse a URL to discover its components
|
3163
3208
|
*
|
3164
3209
|
* @param {String} url The URL to be parsed
|
3165
3210
|
* @returns {Object}
|
@@ -3199,7 +3244,7 @@ const isURLSameOrigin = platform.isStandardBrowserEnv ?
|
|
3199
3244
|
* @returns {boolean} True if URL shares the same origin, otherwise false
|
3200
3245
|
*/
|
3201
3246
|
return function isURLSameOrigin(requestURL) {
|
3202
|
-
const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
|
3247
|
+
const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
|
3203
3248
|
return (parsed.protocol === originURL.protocol &&
|
3204
3249
|
parsed.host === originURL.host);
|
3205
3250
|
};
|
@@ -3247,7 +3292,7 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
3247
3292
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
3248
3293
|
let requestData = config.data;
|
3249
3294
|
const requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
|
3250
|
-
|
3295
|
+
let {responseType, withXSRFToken} = config;
|
3251
3296
|
let onCanceled;
|
3252
3297
|
function done() {
|
3253
3298
|
if (config.cancelToken) {
|
@@ -3261,14 +3306,13 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
3261
3306
|
|
3262
3307
|
let contentType;
|
3263
3308
|
|
3264
|
-
if (utils.isFormData(requestData)) {
|
3265
|
-
if (platform.
|
3309
|
+
if (utils$1.isFormData(requestData)) {
|
3310
|
+
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
3266
3311
|
requestHeaders.setContentType(false); // Let the browser set it
|
3267
|
-
} else if(
|
3268
|
-
requestHeaders.setContentType('multipart/form-data'); // mobile/desktop app frameworks
|
3269
|
-
} else if(utils.isString(contentType = requestHeaders.getContentType())){
|
3312
|
+
} else if ((contentType = requestHeaders.getContentType()) !== false) {
|
3270
3313
|
// fix semicolon duplication issue for ReactNative FormData implementation
|
3271
|
-
|
3314
|
+
const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
|
3315
|
+
requestHeaders.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
|
3272
3316
|
}
|
3273
3317
|
}
|
3274
3318
|
|
@@ -3384,13 +3428,16 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
3384
3428
|
// Add xsrf header
|
3385
3429
|
// This is only done if running in a standard browser environment.
|
3386
3430
|
// Specifically not if we're in a web worker, or react-native.
|
3387
|
-
if
|
3388
|
-
|
3389
|
-
// regarding CVE-2023-45857 config.withCredentials condition was removed temporarily
|
3390
|
-
const xsrfValue = isURLSameOrigin(fullPath) && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
|
3431
|
+
if(platform.hasStandardBrowserEnv) {
|
3432
|
+
withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
|
3391
3433
|
|
3392
|
-
if (
|
3393
|
-
|
3434
|
+
if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
|
3435
|
+
// Add xsrf header
|
3436
|
+
const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
|
3437
|
+
|
3438
|
+
if (xsrfValue) {
|
3439
|
+
requestHeaders.set(config.xsrfHeaderName, xsrfValue);
|
3440
|
+
}
|
3394
3441
|
}
|
3395
3442
|
}
|
3396
3443
|
|
@@ -3399,13 +3446,13 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
3399
3446
|
|
3400
3447
|
// Add headers to the request
|
3401
3448
|
if ('setRequestHeader' in request) {
|
3402
|
-
utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
3449
|
+
utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
3403
3450
|
request.setRequestHeader(key, val);
|
3404
3451
|
});
|
3405
3452
|
}
|
3406
3453
|
|
3407
3454
|
// Add withCredentials to request if needed
|
3408
|
-
if (!utils.isUndefined(config.withCredentials)) {
|
3455
|
+
if (!utils$1.isUndefined(config.withCredentials)) {
|
3409
3456
|
request.withCredentials = !!config.withCredentials;
|
3410
3457
|
}
|
3411
3458
|
|
@@ -3460,7 +3507,7 @@ const knownAdapters = {
|
|
3460
3507
|
xhr: xhrAdapter
|
3461
3508
|
};
|
3462
3509
|
|
3463
|
-
utils.forEach(knownAdapters, (fn, value) => {
|
3510
|
+
utils$1.forEach(knownAdapters, (fn, value) => {
|
3464
3511
|
if (fn) {
|
3465
3512
|
try {
|
3466
3513
|
Object.defineProperty(fn, 'name', {value});
|
@@ -3473,11 +3520,11 @@ utils.forEach(knownAdapters, (fn, value) => {
|
|
3473
3520
|
|
3474
3521
|
const renderReason = (reason) => `- ${reason}`;
|
3475
3522
|
|
3476
|
-
const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;
|
3523
|
+
const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
3477
3524
|
|
3478
3525
|
const adapters = {
|
3479
3526
|
getAdapter: (adapters) => {
|
3480
|
-
adapters = utils.isArray(adapters) ? adapters : [adapters];
|
3527
|
+
adapters = utils$1.isArray(adapters) ? adapters : [adapters];
|
3481
3528
|
|
3482
3529
|
const {length} = adapters;
|
3483
3530
|
let nameOrAdapter;
|
@@ -3618,11 +3665,11 @@ function mergeConfig(config1, config2) {
|
|
3618
3665
|
const config = {};
|
3619
3666
|
|
3620
3667
|
function getMergedValue(target, source, caseless) {
|
3621
|
-
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
3622
|
-
return utils.merge.call({caseless}, target, source);
|
3623
|
-
} else if (utils.isPlainObject(source)) {
|
3624
|
-
return utils.merge({}, source);
|
3625
|
-
} else if (utils.isArray(source)) {
|
3668
|
+
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
3669
|
+
return utils$1.merge.call({caseless}, target, source);
|
3670
|
+
} else if (utils$1.isPlainObject(source)) {
|
3671
|
+
return utils$1.merge({}, source);
|
3672
|
+
} else if (utils$1.isArray(source)) {
|
3626
3673
|
return source.slice();
|
3627
3674
|
}
|
3628
3675
|
return source;
|
@@ -3630,25 +3677,25 @@ function mergeConfig(config1, config2) {
|
|
3630
3677
|
|
3631
3678
|
// eslint-disable-next-line consistent-return
|
3632
3679
|
function mergeDeepProperties(a, b, caseless) {
|
3633
|
-
if (!utils.isUndefined(b)) {
|
3680
|
+
if (!utils$1.isUndefined(b)) {
|
3634
3681
|
return getMergedValue(a, b, caseless);
|
3635
|
-
} else if (!utils.isUndefined(a)) {
|
3682
|
+
} else if (!utils$1.isUndefined(a)) {
|
3636
3683
|
return getMergedValue(undefined, a, caseless);
|
3637
3684
|
}
|
3638
3685
|
}
|
3639
3686
|
|
3640
3687
|
// eslint-disable-next-line consistent-return
|
3641
3688
|
function valueFromConfig2(a, b) {
|
3642
|
-
if (!utils.isUndefined(b)) {
|
3689
|
+
if (!utils$1.isUndefined(b)) {
|
3643
3690
|
return getMergedValue(undefined, b);
|
3644
3691
|
}
|
3645
3692
|
}
|
3646
3693
|
|
3647
3694
|
// eslint-disable-next-line consistent-return
|
3648
3695
|
function defaultToConfig2(a, b) {
|
3649
|
-
if (!utils.isUndefined(b)) {
|
3696
|
+
if (!utils$1.isUndefined(b)) {
|
3650
3697
|
return getMergedValue(undefined, b);
|
3651
|
-
} else if (!utils.isUndefined(a)) {
|
3698
|
+
} else if (!utils$1.isUndefined(a)) {
|
3652
3699
|
return getMergedValue(undefined, a);
|
3653
3700
|
}
|
3654
3701
|
}
|
@@ -3673,6 +3720,7 @@ function mergeConfig(config1, config2) {
|
|
3673
3720
|
timeout: defaultToConfig2,
|
3674
3721
|
timeoutMessage: defaultToConfig2,
|
3675
3722
|
withCredentials: defaultToConfig2,
|
3723
|
+
withXSRFToken: defaultToConfig2,
|
3676
3724
|
adapter: defaultToConfig2,
|
3677
3725
|
responseType: defaultToConfig2,
|
3678
3726
|
xsrfCookieName: defaultToConfig2,
|
@@ -3693,10 +3741,10 @@ function mergeConfig(config1, config2) {
|
|
3693
3741
|
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
|
3694
3742
|
};
|
3695
3743
|
|
3696
|
-
utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
3744
|
+
utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
3697
3745
|
const merge = mergeMap[prop] || mergeDeepProperties;
|
3698
3746
|
const configValue = merge(config1[prop], config2[prop], prop);
|
3699
|
-
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
3747
|
+
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
3700
3748
|
});
|
3701
3749
|
|
3702
3750
|
return config;
|
@@ -3838,7 +3886,7 @@ class Axios {
|
|
3838
3886
|
}
|
3839
3887
|
|
3840
3888
|
if (paramsSerializer != null) {
|
3841
|
-
if (utils.isFunction(paramsSerializer)) {
|
3889
|
+
if (utils$1.isFunction(paramsSerializer)) {
|
3842
3890
|
config.paramsSerializer = {
|
3843
3891
|
serialize: paramsSerializer
|
3844
3892
|
};
|
@@ -3854,12 +3902,12 @@ class Axios {
|
|
3854
3902
|
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
3855
3903
|
|
3856
3904
|
// Flatten headers
|
3857
|
-
let contextHeaders = headers && utils.merge(
|
3905
|
+
let contextHeaders = headers && utils$1.merge(
|
3858
3906
|
headers.common,
|
3859
3907
|
headers[config.method]
|
3860
3908
|
);
|
3861
3909
|
|
3862
|
-
headers && utils.forEach(
|
3910
|
+
headers && utils$1.forEach(
|
3863
3911
|
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
3864
3912
|
(method) => {
|
3865
3913
|
delete headers[method];
|
@@ -3946,7 +3994,7 @@ class Axios {
|
|
3946
3994
|
}
|
3947
3995
|
|
3948
3996
|
// Provide aliases for supported request methods
|
3949
|
-
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
3997
|
+
utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
3950
3998
|
/*eslint func-names:0*/
|
3951
3999
|
Axios.prototype[method] = function(url, config) {
|
3952
4000
|
return this.request(mergeConfig(config || {}, {
|
@@ -3957,7 +4005,7 @@ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData
|
|
3957
4005
|
};
|
3958
4006
|
});
|
3959
4007
|
|
3960
|
-
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
4008
|
+
utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
3961
4009
|
/*eslint func-names:0*/
|
3962
4010
|
|
3963
4011
|
function generateHTTPMethod(isForm) {
|
@@ -4133,7 +4181,7 @@ function spread(callback) {
|
|
4133
4181
|
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
4134
4182
|
*/
|
4135
4183
|
function isAxiosError(payload) {
|
4136
|
-
return utils.isObject(payload) && (payload.isAxiosError === true);
|
4184
|
+
return utils$1.isObject(payload) && (payload.isAxiosError === true);
|
4137
4185
|
}
|
4138
4186
|
|
4139
4187
|
const HttpStatusCode = {
|
@@ -4220,10 +4268,10 @@ function createInstance(defaultConfig) {
|
|
4220
4268
|
const instance = bind(Axios$1.prototype.request, context);
|
4221
4269
|
|
4222
4270
|
// Copy axios.prototype to instance
|
4223
|
-
utils.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
|
4271
|
+
utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
|
4224
4272
|
|
4225
4273
|
// Copy context to instance
|
4226
|
-
utils.extend(instance, context, null, {allOwnKeys: true});
|
4274
|
+
utils$1.extend(instance, context, null, {allOwnKeys: true});
|
4227
4275
|
|
4228
4276
|
// Factory for creating new instances
|
4229
4277
|
instance.create = function create(instanceConfig) {
|
@@ -4267,7 +4315,7 @@ axios.mergeConfig = mergeConfig;
|
|
4267
4315
|
|
4268
4316
|
axios.AxiosHeaders = AxiosHeaders$1;
|
4269
4317
|
|
4270
|
-
axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
|
4318
|
+
axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
|
4271
4319
|
|
4272
4320
|
axios.getAdapter = adapters.getAdapter;
|
4273
4321
|
|