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/dist/esm/axios.js CHANGED
@@ -1,4 +1,4 @@
1
- // Axios v1.6.0 Copyright (c) 2023 Matt Zabriskie and contributors
1
+ // Axios v1.6.2 Copyright (c) 2023 Matt Zabriskie and contributors
2
2
  function bind(fn, thisArg) {
3
3
  return function wrap() {
4
4
  return fn.apply(thisArg, arguments);
@@ -671,7 +671,7 @@ const isAsyncFn = kindOfTest('AsyncFunction');
671
671
  const isThenable = (thing) =>
672
672
  thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
673
673
 
674
- const utils = {
674
+ const utils$1 = {
675
675
  isArray,
676
676
  isArrayBuffer,
677
677
  isBuffer,
@@ -753,7 +753,7 @@ function AxiosError$1(message, code, config, request, response) {
753
753
  response && (this.response = response);
754
754
  }
755
755
 
756
- utils.inherits(AxiosError$1, Error, {
756
+ utils$1.inherits(AxiosError$1, Error, {
757
757
  toJSON: function toJSON() {
758
758
  return {
759
759
  // Standard
@@ -768,7 +768,7 @@ utils.inherits(AxiosError$1, Error, {
768
768
  columnNumber: this.columnNumber,
769
769
  stack: this.stack,
770
770
  // Axios
771
- config: utils.toJSONObject(this.config),
771
+ config: utils$1.toJSONObject(this.config),
772
772
  code: this.code,
773
773
  status: this.response && this.response.status ? this.response.status : null
774
774
  };
@@ -803,7 +803,7 @@ Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
803
803
  AxiosError$1.from = (error, code, config, request, response, customProps) => {
804
804
  const axiosError = Object.create(prototype$1);
805
805
 
806
- utils.toFlatObject(error, axiosError, function filter(obj) {
806
+ utils$1.toFlatObject(error, axiosError, function filter(obj) {
807
807
  return obj !== Error.prototype;
808
808
  }, prop => {
809
809
  return prop !== 'isAxiosError';
@@ -831,7 +831,7 @@ const httpAdapter = null;
831
831
  * @returns {boolean}
832
832
  */
833
833
  function isVisitable(thing) {
834
- return utils.isPlainObject(thing) || utils.isArray(thing);
834
+ return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
835
835
  }
836
836
 
837
837
  /**
@@ -842,7 +842,7 @@ function isVisitable(thing) {
842
842
  * @returns {string} the key without the brackets.
843
843
  */
844
844
  function removeBrackets(key) {
845
- return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
845
+ return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
846
846
  }
847
847
 
848
848
  /**
@@ -871,10 +871,10 @@ function renderKey(path, key, dots) {
871
871
  * @returns {boolean}
872
872
  */
873
873
  function isFlatArray(arr) {
874
- return utils.isArray(arr) && !arr.some(isVisitable);
874
+ return utils$1.isArray(arr) && !arr.some(isVisitable);
875
875
  }
876
876
 
877
- const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
877
+ const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
878
878
  return /^is[A-Z]/.test(prop);
879
879
  });
880
880
 
@@ -902,7 +902,7 @@ const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
902
902
  * @returns
903
903
  */
904
904
  function toFormData$1(obj, formData, options) {
905
- if (!utils.isObject(obj)) {
905
+ if (!utils$1.isObject(obj)) {
906
906
  throw new TypeError('target must be an object');
907
907
  }
908
908
 
@@ -910,13 +910,13 @@ function toFormData$1(obj, formData, options) {
910
910
  formData = formData || new (FormData)();
911
911
 
912
912
  // eslint-disable-next-line no-param-reassign
913
- options = utils.toFlatObject(options, {
913
+ options = utils$1.toFlatObject(options, {
914
914
  metaTokens: true,
915
915
  dots: false,
916
916
  indexes: false
917
917
  }, false, function defined(option, source) {
918
918
  // eslint-disable-next-line no-eq-null,eqeqeq
919
- return !utils.isUndefined(source[option]);
919
+ return !utils$1.isUndefined(source[option]);
920
920
  });
921
921
 
922
922
  const metaTokens = options.metaTokens;
@@ -925,24 +925,24 @@ function toFormData$1(obj, formData, options) {
925
925
  const dots = options.dots;
926
926
  const indexes = options.indexes;
927
927
  const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
928
- const useBlob = _Blob && utils.isSpecCompliantForm(formData);
928
+ const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
929
929
 
930
- if (!utils.isFunction(visitor)) {
930
+ if (!utils$1.isFunction(visitor)) {
931
931
  throw new TypeError('visitor must be a function');
932
932
  }
933
933
 
934
934
  function convertValue(value) {
935
935
  if (value === null) return '';
936
936
 
937
- if (utils.isDate(value)) {
937
+ if (utils$1.isDate(value)) {
938
938
  return value.toISOString();
939
939
  }
940
940
 
941
- if (!useBlob && utils.isBlob(value)) {
941
+ if (!useBlob && utils$1.isBlob(value)) {
942
942
  throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
943
943
  }
944
944
 
945
- if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
945
+ if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
946
946
  return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
947
947
  }
948
948
 
@@ -963,20 +963,20 @@ function toFormData$1(obj, formData, options) {
963
963
  let arr = value;
964
964
 
965
965
  if (value && !path && typeof value === 'object') {
966
- if (utils.endsWith(key, '{}')) {
966
+ if (utils$1.endsWith(key, '{}')) {
967
967
  // eslint-disable-next-line no-param-reassign
968
968
  key = metaTokens ? key : key.slice(0, -2);
969
969
  // eslint-disable-next-line no-param-reassign
970
970
  value = JSON.stringify(value);
971
971
  } else if (
972
- (utils.isArray(value) && isFlatArray(value)) ||
973
- ((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))
972
+ (utils$1.isArray(value) && isFlatArray(value)) ||
973
+ ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
974
974
  )) {
975
975
  // eslint-disable-next-line no-param-reassign
976
976
  key = removeBrackets(key);
977
977
 
978
978
  arr.forEach(function each(el, index) {
979
- !(utils.isUndefined(el) || el === null) && formData.append(
979
+ !(utils$1.isUndefined(el) || el === null) && formData.append(
980
980
  // eslint-disable-next-line no-nested-ternary
981
981
  indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
982
982
  convertValue(el)
@@ -1004,7 +1004,7 @@ function toFormData$1(obj, formData, options) {
1004
1004
  });
1005
1005
 
1006
1006
  function build(value, path) {
1007
- if (utils.isUndefined(value)) return;
1007
+ if (utils$1.isUndefined(value)) return;
1008
1008
 
1009
1009
  if (stack.indexOf(value) !== -1) {
1010
1010
  throw Error('Circular reference detected in ' + path.join('.'));
@@ -1012,9 +1012,9 @@ function toFormData$1(obj, formData, options) {
1012
1012
 
1013
1013
  stack.push(value);
1014
1014
 
1015
- utils.forEach(value, function each(el, key) {
1016
- const result = !(utils.isUndefined(el) || el === null) && visitor.call(
1017
- formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
1015
+ utils$1.forEach(value, function each(el, key) {
1016
+ const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
1017
+ formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers
1018
1018
  );
1019
1019
 
1020
1020
  if (result === true) {
@@ -1025,7 +1025,7 @@ function toFormData$1(obj, formData, options) {
1025
1025
  stack.pop();
1026
1026
  }
1027
1027
 
1028
- if (!utils.isObject(obj)) {
1028
+ if (!utils$1.isObject(obj)) {
1029
1029
  throw new TypeError('data must be an object');
1030
1030
  }
1031
1031
 
@@ -1129,7 +1129,7 @@ function buildURL(url, params, options) {
1129
1129
  if (serializeFn) {
1130
1130
  serializedParams = serializeFn(params, options);
1131
1131
  } else {
1132
- serializedParams = utils.isURLSearchParams(params) ?
1132
+ serializedParams = utils$1.isURLSearchParams(params) ?
1133
1133
  params.toString() :
1134
1134
  new AxiosURLSearchParams(params, options).toString(_encode);
1135
1135
  }
@@ -1204,7 +1204,7 @@ class InterceptorManager {
1204
1204
  * @returns {void}
1205
1205
  */
1206
1206
  forEach(fn) {
1207
- utils.forEach(this.handlers, function forEachHandler(h) {
1207
+ utils$1.forEach(this.handlers, function forEachHandler(h) {
1208
1208
  if (h !== null) {
1209
1209
  fn(h);
1210
1210
  }
@@ -1226,6 +1226,18 @@ const FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
1226
1226
 
1227
1227
  const Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
1228
1228
 
1229
+ const platform$1 = {
1230
+ isBrowser: true,
1231
+ classes: {
1232
+ URLSearchParams: URLSearchParams$1,
1233
+ FormData: FormData$1,
1234
+ Blob: Blob$1
1235
+ },
1236
+ protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
1237
+ };
1238
+
1239
+ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
1240
+
1229
1241
  /**
1230
1242
  * Determine if we're running in a standard browser environment
1231
1243
  *
@@ -1243,18 +1255,10 @@ const Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
1243
1255
  *
1244
1256
  * @returns {boolean}
1245
1257
  */
1246
- const isStandardBrowserEnv = (() => {
1247
- let product;
1248
- if (typeof navigator !== 'undefined' && (
1249
- (product = navigator.product) === 'ReactNative' ||
1250
- product === 'NativeScript' ||
1251
- product === 'NS')
1252
- ) {
1253
- return false;
1254
- }
1255
-
1256
- return typeof window !== 'undefined' && typeof document !== 'undefined';
1257
- })();
1258
+ const hasStandardBrowserEnv = (
1259
+ (product) => {
1260
+ return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
1261
+ })(typeof navigator !== 'undefined' && navigator.product);
1258
1262
 
1259
1263
  /**
1260
1264
  * Determine if we're running in a standard browser webWorker environment
@@ -1265,7 +1269,7 @@ const isStandardBrowserEnv = (() => {
1265
1269
  * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
1266
1270
  * This leads to a problem when axios post `FormData` in webWorker
1267
1271
  */
1268
- const isStandardBrowserWebWorkerEnv = (() => {
1272
+ const hasStandardBrowserWebWorkerEnv = (() => {
1269
1273
  return (
1270
1274
  typeof WorkerGlobalScope !== 'undefined' &&
1271
1275
  // eslint-disable-next-line no-undef
@@ -1274,23 +1278,22 @@ const isStandardBrowserEnv = (() => {
1274
1278
  );
1275
1279
  })();
1276
1280
 
1281
+ const utils = /*#__PURE__*/Object.freeze({
1282
+ __proto__: null,
1283
+ hasBrowserEnv: hasBrowserEnv,
1284
+ hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
1285
+ hasStandardBrowserEnv: hasStandardBrowserEnv
1286
+ });
1277
1287
 
1278
1288
  const platform = {
1279
- isBrowser: true,
1280
- classes: {
1281
- URLSearchParams: URLSearchParams$1,
1282
- FormData: FormData$1,
1283
- Blob: Blob$1
1284
- },
1285
- isStandardBrowserEnv,
1286
- isStandardBrowserWebWorkerEnv,
1287
- protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
1289
+ ...utils,
1290
+ ...platform$1
1288
1291
  };
1289
1292
 
1290
1293
  function toURLEncodedForm(data, options) {
1291
1294
  return toFormData$1(data, new platform.classes.URLSearchParams(), Object.assign({
1292
1295
  visitor: function(value, key, path, helpers) {
1293
- if (platform.isNode && utils.isBuffer(value)) {
1296
+ if (platform.isNode && utils$1.isBuffer(value)) {
1294
1297
  this.append(key, value.toString('base64'));
1295
1298
  return false;
1296
1299
  }
@@ -1312,7 +1315,7 @@ function parsePropPath(name) {
1312
1315
  // foo.x.y.z
1313
1316
  // foo-x-y-z
1314
1317
  // foo x y z
1315
- return utils.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
1318
+ return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
1316
1319
  return match[0] === '[]' ? '' : match[1] || match[0];
1317
1320
  });
1318
1321
  }
@@ -1349,10 +1352,10 @@ function formDataToJSON(formData) {
1349
1352
  let name = path[index++];
1350
1353
  const isNumericKey = Number.isFinite(+name);
1351
1354
  const isLast = index >= path.length;
1352
- name = !name && utils.isArray(target) ? target.length : name;
1355
+ name = !name && utils$1.isArray(target) ? target.length : name;
1353
1356
 
1354
1357
  if (isLast) {
1355
- if (utils.hasOwnProp(target, name)) {
1358
+ if (utils$1.hasOwnProp(target, name)) {
1356
1359
  target[name] = [target[name], value];
1357
1360
  } else {
1358
1361
  target[name] = value;
@@ -1361,23 +1364,23 @@ function formDataToJSON(formData) {
1361
1364
  return !isNumericKey;
1362
1365
  }
1363
1366
 
1364
- if (!target[name] || !utils.isObject(target[name])) {
1367
+ if (!target[name] || !utils$1.isObject(target[name])) {
1365
1368
  target[name] = [];
1366
1369
  }
1367
1370
 
1368
1371
  const result = buildPath(path, value, target[name], index);
1369
1372
 
1370
- if (result && utils.isArray(target[name])) {
1373
+ if (result && utils$1.isArray(target[name])) {
1371
1374
  target[name] = arrayToObject(target[name]);
1372
1375
  }
1373
1376
 
1374
1377
  return !isNumericKey;
1375
1378
  }
1376
1379
 
1377
- if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
1380
+ if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
1378
1381
  const obj = {};
1379
1382
 
1380
- utils.forEachEntry(formData, (name, value) => {
1383
+ utils$1.forEachEntry(formData, (name, value) => {
1381
1384
  buildPath(parsePropPath(name), value, obj, 0);
1382
1385
  });
1383
1386
 
@@ -1398,10 +1401,10 @@ function formDataToJSON(formData) {
1398
1401
  * @returns {string} A stringified version of the rawValue.
1399
1402
  */
1400
1403
  function stringifySafely(rawValue, parser, encoder) {
1401
- if (utils.isString(rawValue)) {
1404
+ if (utils$1.isString(rawValue)) {
1402
1405
  try {
1403
1406
  (parser || JSON.parse)(rawValue);
1404
- return utils.trim(rawValue);
1407
+ return utils$1.trim(rawValue);
1405
1408
  } catch (e) {
1406
1409
  if (e.name !== 'SyntaxError') {
1407
1410
  throw e;
@@ -1421,13 +1424,13 @@ const defaults = {
1421
1424
  transformRequest: [function transformRequest(data, headers) {
1422
1425
  const contentType = headers.getContentType() || '';
1423
1426
  const hasJSONContentType = contentType.indexOf('application/json') > -1;
1424
- const isObjectPayload = utils.isObject(data);
1427
+ const isObjectPayload = utils$1.isObject(data);
1425
1428
 
1426
- if (isObjectPayload && utils.isHTMLForm(data)) {
1429
+ if (isObjectPayload && utils$1.isHTMLForm(data)) {
1427
1430
  data = new FormData(data);
1428
1431
  }
1429
1432
 
1430
- const isFormData = utils.isFormData(data);
1433
+ const isFormData = utils$1.isFormData(data);
1431
1434
 
1432
1435
  if (isFormData) {
1433
1436
  if (!hasJSONContentType) {
@@ -1436,18 +1439,18 @@ const defaults = {
1436
1439
  return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
1437
1440
  }
1438
1441
 
1439
- if (utils.isArrayBuffer(data) ||
1440
- utils.isBuffer(data) ||
1441
- utils.isStream(data) ||
1442
- utils.isFile(data) ||
1443
- utils.isBlob(data)
1442
+ if (utils$1.isArrayBuffer(data) ||
1443
+ utils$1.isBuffer(data) ||
1444
+ utils$1.isStream(data) ||
1445
+ utils$1.isFile(data) ||
1446
+ utils$1.isBlob(data)
1444
1447
  ) {
1445
1448
  return data;
1446
1449
  }
1447
- if (utils.isArrayBufferView(data)) {
1450
+ if (utils$1.isArrayBufferView(data)) {
1448
1451
  return data.buffer;
1449
1452
  }
1450
- if (utils.isURLSearchParams(data)) {
1453
+ if (utils$1.isURLSearchParams(data)) {
1451
1454
  headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
1452
1455
  return data.toString();
1453
1456
  }
@@ -1459,7 +1462,7 @@ const defaults = {
1459
1462
  return toURLEncodedForm(data, this.formSerializer).toString();
1460
1463
  }
1461
1464
 
1462
- if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
1465
+ if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
1463
1466
  const _FormData = this.env && this.env.FormData;
1464
1467
 
1465
1468
  return toFormData$1(
@@ -1483,7 +1486,7 @@ const defaults = {
1483
1486
  const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
1484
1487
  const JSONRequested = this.responseType === 'json';
1485
1488
 
1486
- if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
1489
+ if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
1487
1490
  const silentJSONParsing = transitional && transitional.silentJSONParsing;
1488
1491
  const strictJSONParsing = !silentJSONParsing && JSONRequested;
1489
1492
 
@@ -1531,7 +1534,7 @@ const defaults = {
1531
1534
  }
1532
1535
  };
1533
1536
 
1534
- utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
1537
+ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
1535
1538
  defaults.headers[method] = {};
1536
1539
  });
1537
1540
 
@@ -1539,7 +1542,7 @@ const defaults$1 = defaults;
1539
1542
 
1540
1543
  // RawAxiosHeaders whose duplicates are ignored by node
1541
1544
  // c.f. https://nodejs.org/api/http.html#http_message_headers
1542
- const ignoreDuplicateOf = utils.toObjectSet([
1545
+ const ignoreDuplicateOf = utils$1.toObjectSet([
1543
1546
  'age', 'authorization', 'content-length', 'content-type', 'etag',
1544
1547
  'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
1545
1548
  'last-modified', 'location', 'max-forwards', 'proxy-authorization',
@@ -1600,7 +1603,7 @@ function normalizeValue(value) {
1600
1603
  return value;
1601
1604
  }
1602
1605
 
1603
- return utils.isArray(value) ? value.map(normalizeValue) : String(value);
1606
+ return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
1604
1607
  }
1605
1608
 
1606
1609
  function parseTokens(str) {
@@ -1618,7 +1621,7 @@ function parseTokens(str) {
1618
1621
  const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
1619
1622
 
1620
1623
  function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
1621
- if (utils.isFunction(filter)) {
1624
+ if (utils$1.isFunction(filter)) {
1622
1625
  return filter.call(this, value, header);
1623
1626
  }
1624
1627
 
@@ -1626,13 +1629,13 @@ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
1626
1629
  value = header;
1627
1630
  }
1628
1631
 
1629
- if (!utils.isString(value)) return;
1632
+ if (!utils$1.isString(value)) return;
1630
1633
 
1631
- if (utils.isString(filter)) {
1634
+ if (utils$1.isString(filter)) {
1632
1635
  return value.indexOf(filter) !== -1;
1633
1636
  }
1634
1637
 
1635
- if (utils.isRegExp(filter)) {
1638
+ if (utils$1.isRegExp(filter)) {
1636
1639
  return filter.test(value);
1637
1640
  }
1638
1641
  }
@@ -1645,7 +1648,7 @@ function formatHeader(header) {
1645
1648
  }
1646
1649
 
1647
1650
  function buildAccessors(obj, header) {
1648
- const accessorName = utils.toCamelCase(' ' + header);
1651
+ const accessorName = utils$1.toCamelCase(' ' + header);
1649
1652
 
1650
1653
  ['get', 'set', 'has'].forEach(methodName => {
1651
1654
  Object.defineProperty(obj, methodName + accessorName, {
@@ -1672,7 +1675,7 @@ class AxiosHeaders$1 {
1672
1675
  throw new Error('header name must be a non-empty string');
1673
1676
  }
1674
1677
 
1675
- const key = utils.findKey(self, lHeader);
1678
+ const key = utils$1.findKey(self, lHeader);
1676
1679
 
1677
1680
  if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
1678
1681
  self[key || _header] = normalizeValue(_value);
@@ -1680,11 +1683,11 @@ class AxiosHeaders$1 {
1680
1683
  }
1681
1684
 
1682
1685
  const setHeaders = (headers, _rewrite) =>
1683
- utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
1686
+ utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
1684
1687
 
1685
- if (utils.isPlainObject(header) || header instanceof this.constructor) {
1688
+ if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
1686
1689
  setHeaders(header, valueOrRewrite);
1687
- } else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1690
+ } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1688
1691
  setHeaders(parseHeaders(header), valueOrRewrite);
1689
1692
  } else {
1690
1693
  header != null && setHeader(valueOrRewrite, header, rewrite);
@@ -1697,7 +1700,7 @@ class AxiosHeaders$1 {
1697
1700
  header = normalizeHeader(header);
1698
1701
 
1699
1702
  if (header) {
1700
- const key = utils.findKey(this, header);
1703
+ const key = utils$1.findKey(this, header);
1701
1704
 
1702
1705
  if (key) {
1703
1706
  const value = this[key];
@@ -1710,11 +1713,11 @@ class AxiosHeaders$1 {
1710
1713
  return parseTokens(value);
1711
1714
  }
1712
1715
 
1713
- if (utils.isFunction(parser)) {
1716
+ if (utils$1.isFunction(parser)) {
1714
1717
  return parser.call(this, value, key);
1715
1718
  }
1716
1719
 
1717
- if (utils.isRegExp(parser)) {
1720
+ if (utils$1.isRegExp(parser)) {
1718
1721
  return parser.exec(value);
1719
1722
  }
1720
1723
 
@@ -1727,7 +1730,7 @@ class AxiosHeaders$1 {
1727
1730
  header = normalizeHeader(header);
1728
1731
 
1729
1732
  if (header) {
1730
- const key = utils.findKey(this, header);
1733
+ const key = utils$1.findKey(this, header);
1731
1734
 
1732
1735
  return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
1733
1736
  }
@@ -1743,7 +1746,7 @@ class AxiosHeaders$1 {
1743
1746
  _header = normalizeHeader(_header);
1744
1747
 
1745
1748
  if (_header) {
1746
- const key = utils.findKey(self, _header);
1749
+ const key = utils$1.findKey(self, _header);
1747
1750
 
1748
1751
  if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
1749
1752
  delete self[key];
@@ -1753,7 +1756,7 @@ class AxiosHeaders$1 {
1753
1756
  }
1754
1757
  }
1755
1758
 
1756
- if (utils.isArray(header)) {
1759
+ if (utils$1.isArray(header)) {
1757
1760
  header.forEach(deleteHeader);
1758
1761
  } else {
1759
1762
  deleteHeader(header);
@@ -1782,8 +1785,8 @@ class AxiosHeaders$1 {
1782
1785
  const self = this;
1783
1786
  const headers = {};
1784
1787
 
1785
- utils.forEach(this, (value, header) => {
1786
- const key = utils.findKey(headers, header);
1788
+ utils$1.forEach(this, (value, header) => {
1789
+ const key = utils$1.findKey(headers, header);
1787
1790
 
1788
1791
  if (key) {
1789
1792
  self[key] = normalizeValue(value);
@@ -1812,8 +1815,8 @@ class AxiosHeaders$1 {
1812
1815
  toJSON(asStrings) {
1813
1816
  const obj = Object.create(null);
1814
1817
 
1815
- utils.forEach(this, (value, header) => {
1816
- value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);
1818
+ utils$1.forEach(this, (value, header) => {
1819
+ value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
1817
1820
  });
1818
1821
 
1819
1822
  return obj;
@@ -1860,7 +1863,7 @@ class AxiosHeaders$1 {
1860
1863
  }
1861
1864
  }
1862
1865
 
1863
- utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
1866
+ utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
1864
1867
 
1865
1868
  return this;
1866
1869
  }
@@ -1869,7 +1872,7 @@ class AxiosHeaders$1 {
1869
1872
  AxiosHeaders$1.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
1870
1873
 
1871
1874
  // reserved names hotfix
1872
- utils.reduceDescriptors(AxiosHeaders$1.prototype, ({value}, key) => {
1875
+ utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({value}, key) => {
1873
1876
  let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
1874
1877
  return {
1875
1878
  get: () => value,
@@ -1879,7 +1882,7 @@ utils.reduceDescriptors(AxiosHeaders$1.prototype, ({value}, key) => {
1879
1882
  }
1880
1883
  });
1881
1884
 
1882
- utils.freezeMethods(AxiosHeaders$1);
1885
+ utils$1.freezeMethods(AxiosHeaders$1);
1883
1886
 
1884
1887
  const AxiosHeaders$2 = AxiosHeaders$1;
1885
1888
 
@@ -1897,7 +1900,7 @@ function transformData(fns, response) {
1897
1900
  const headers = AxiosHeaders$2.from(context.headers);
1898
1901
  let data = context.data;
1899
1902
 
1900
- utils.forEach(fns, function transform(fn) {
1903
+ utils$1.forEach(fns, function transform(fn) {
1901
1904
  data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
1902
1905
  });
1903
1906
 
@@ -1925,7 +1928,7 @@ function CanceledError$1(message, config, request) {
1925
1928
  this.name = 'CanceledError';
1926
1929
  }
1927
1930
 
1928
- utils.inherits(CanceledError$1, AxiosError$1, {
1931
+ utils$1.inherits(CanceledError$1, AxiosError$1, {
1929
1932
  __CANCEL__: true
1930
1933
  });
1931
1934
 
@@ -1953,53 +1956,44 @@ function settle(resolve, reject, response) {
1953
1956
  }
1954
1957
  }
1955
1958
 
1956
- const cookies = platform.isStandardBrowserEnv ?
1959
+ const cookies = platform.hasStandardBrowserEnv ?
1957
1960
 
1958
- // Standard browser envs support document.cookie
1959
- (function standardBrowserEnv() {
1960
- return {
1961
- write: function write(name, value, expires, path, domain, secure) {
1962
- const cookie = [];
1963
- cookie.push(name + '=' + encodeURIComponent(value));
1961
+ // Standard browser envs support document.cookie
1962
+ {
1963
+ write(name, value, expires, path, domain, secure) {
1964
+ const cookie = [name + '=' + encodeURIComponent(value)];
1964
1965
 
1965
- if (utils.isNumber(expires)) {
1966
- cookie.push('expires=' + new Date(expires).toGMTString());
1967
- }
1966
+ utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
1968
1967
 
1969
- if (utils.isString(path)) {
1970
- cookie.push('path=' + path);
1971
- }
1968
+ utils$1.isString(path) && cookie.push('path=' + path);
1972
1969
 
1973
- if (utils.isString(domain)) {
1974
- cookie.push('domain=' + domain);
1975
- }
1970
+ utils$1.isString(domain) && cookie.push('domain=' + domain);
1976
1971
 
1977
- if (secure === true) {
1978
- cookie.push('secure');
1979
- }
1972
+ secure === true && cookie.push('secure');
1980
1973
 
1981
- document.cookie = cookie.join('; ');
1982
- },
1974
+ document.cookie = cookie.join('; ');
1975
+ },
1983
1976
 
1984
- read: function read(name) {
1985
- const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
1986
- return (match ? decodeURIComponent(match[3]) : null);
1987
- },
1977
+ read(name) {
1978
+ const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
1979
+ return (match ? decodeURIComponent(match[3]) : null);
1980
+ },
1988
1981
 
1989
- remove: function remove(name) {
1990
- this.write(name, '', Date.now() - 86400000);
1991
- }
1992
- };
1993
- })() :
1982
+ remove(name) {
1983
+ this.write(name, '', Date.now() - 86400000);
1984
+ }
1985
+ }
1994
1986
 
1995
- // Non standard browser env (web workers, react-native) lack needed support.
1996
- (function nonStandardBrowserEnv() {
1997
- return {
1998
- write: function write() {},
1999
- read: function read() { return null; },
2000
- remove: function remove() {}
2001
- };
2002
- })();
1987
+ :
1988
+
1989
+ // Non-standard browser env (web workers, react-native) lack needed support.
1990
+ {
1991
+ write() {},
1992
+ read() {
1993
+ return null;
1994
+ },
1995
+ remove() {}
1996
+ };
2003
1997
 
2004
1998
  /**
2005
1999
  * Determines whether the specified URL is absolute
@@ -2046,7 +2040,7 @@ function buildFullPath(baseURL, requestedURL) {
2046
2040
  return requestedURL;
2047
2041
  }
2048
2042
 
2049
- const isURLSameOrigin = platform.isStandardBrowserEnv ?
2043
+ const isURLSameOrigin = platform.hasStandardBrowserEnv ?
2050
2044
 
2051
2045
  // Standard browser envs have full support of the APIs needed to test
2052
2046
  // whether the request URL is of the same origin as current location.
@@ -2056,7 +2050,7 @@ const isURLSameOrigin = platform.isStandardBrowserEnv ?
2056
2050
  let originURL;
2057
2051
 
2058
2052
  /**
2059
- * Parse a URL to discover it's components
2053
+ * Parse a URL to discover its components
2060
2054
  *
2061
2055
  * @param {String} url The URL to be parsed
2062
2056
  * @returns {Object}
@@ -2096,7 +2090,7 @@ const isURLSameOrigin = platform.isStandardBrowserEnv ?
2096
2090
  * @returns {boolean} True if URL shares the same origin, otherwise false
2097
2091
  */
2098
2092
  return function isURLSameOrigin(requestURL) {
2099
- const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
2093
+ const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
2100
2094
  return (parsed.protocol === originURL.protocol &&
2101
2095
  parsed.host === originURL.host);
2102
2096
  };
@@ -2201,7 +2195,7 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
2201
2195
  return new Promise(function dispatchXhrRequest(resolve, reject) {
2202
2196
  let requestData = config.data;
2203
2197
  const requestHeaders = AxiosHeaders$2.from(config.headers).normalize();
2204
- const responseType = config.responseType;
2198
+ let {responseType, withXSRFToken} = config;
2205
2199
  let onCanceled;
2206
2200
  function done() {
2207
2201
  if (config.cancelToken) {
@@ -2215,14 +2209,13 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
2215
2209
 
2216
2210
  let contentType;
2217
2211
 
2218
- if (utils.isFormData(requestData)) {
2219
- if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
2212
+ if (utils$1.isFormData(requestData)) {
2213
+ if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
2220
2214
  requestHeaders.setContentType(false); // Let the browser set it
2221
- } else if(!requestHeaders.getContentType(/^\s*multipart\/form-data/)){
2222
- requestHeaders.setContentType('multipart/form-data'); // mobile/desktop app frameworks
2223
- } else if(utils.isString(contentType = requestHeaders.getContentType())){
2215
+ } else if ((contentType = requestHeaders.getContentType()) !== false) {
2224
2216
  // fix semicolon duplication issue for ReactNative FormData implementation
2225
- requestHeaders.setContentType(contentType.replace(/^\s*(multipart\/form-data);+/, '$1'));
2217
+ const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
2218
+ requestHeaders.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
2226
2219
  }
2227
2220
  }
2228
2221
 
@@ -2338,13 +2331,16 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
2338
2331
  // Add xsrf header
2339
2332
  // This is only done if running in a standard browser environment.
2340
2333
  // Specifically not if we're in a web worker, or react-native.
2341
- if (platform.isStandardBrowserEnv) {
2342
- // Add xsrf header
2343
- // regarding CVE-2023-45857 config.withCredentials condition was removed temporarily
2344
- const xsrfValue = isURLSameOrigin(fullPath) && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
2334
+ if(platform.hasStandardBrowserEnv) {
2335
+ withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
2345
2336
 
2346
- if (xsrfValue) {
2347
- requestHeaders.set(config.xsrfHeaderName, xsrfValue);
2337
+ if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
2338
+ // Add xsrf header
2339
+ const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
2340
+
2341
+ if (xsrfValue) {
2342
+ requestHeaders.set(config.xsrfHeaderName, xsrfValue);
2343
+ }
2348
2344
  }
2349
2345
  }
2350
2346
 
@@ -2353,13 +2349,13 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
2353
2349
 
2354
2350
  // Add headers to the request
2355
2351
  if ('setRequestHeader' in request) {
2356
- utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
2352
+ utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
2357
2353
  request.setRequestHeader(key, val);
2358
2354
  });
2359
2355
  }
2360
2356
 
2361
2357
  // Add withCredentials to request if needed
2362
- if (!utils.isUndefined(config.withCredentials)) {
2358
+ if (!utils$1.isUndefined(config.withCredentials)) {
2363
2359
  request.withCredentials = !!config.withCredentials;
2364
2360
  }
2365
2361
 
@@ -2414,7 +2410,7 @@ const knownAdapters = {
2414
2410
  xhr: xhrAdapter
2415
2411
  };
2416
2412
 
2417
- utils.forEach(knownAdapters, (fn, value) => {
2413
+ utils$1.forEach(knownAdapters, (fn, value) => {
2418
2414
  if (fn) {
2419
2415
  try {
2420
2416
  Object.defineProperty(fn, 'name', {value});
@@ -2427,11 +2423,11 @@ utils.forEach(knownAdapters, (fn, value) => {
2427
2423
 
2428
2424
  const renderReason = (reason) => `- ${reason}`;
2429
2425
 
2430
- const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;
2426
+ const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
2431
2427
 
2432
2428
  const adapters = {
2433
2429
  getAdapter: (adapters) => {
2434
- adapters = utils.isArray(adapters) ? adapters : [adapters];
2430
+ adapters = utils$1.isArray(adapters) ? adapters : [adapters];
2435
2431
 
2436
2432
  const {length} = adapters;
2437
2433
  let nameOrAdapter;
@@ -2572,11 +2568,11 @@ function mergeConfig$1(config1, config2) {
2572
2568
  const config = {};
2573
2569
 
2574
2570
  function getMergedValue(target, source, caseless) {
2575
- if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
2576
- return utils.merge.call({caseless}, target, source);
2577
- } else if (utils.isPlainObject(source)) {
2578
- return utils.merge({}, source);
2579
- } else if (utils.isArray(source)) {
2571
+ if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
2572
+ return utils$1.merge.call({caseless}, target, source);
2573
+ } else if (utils$1.isPlainObject(source)) {
2574
+ return utils$1.merge({}, source);
2575
+ } else if (utils$1.isArray(source)) {
2580
2576
  return source.slice();
2581
2577
  }
2582
2578
  return source;
@@ -2584,25 +2580,25 @@ function mergeConfig$1(config1, config2) {
2584
2580
 
2585
2581
  // eslint-disable-next-line consistent-return
2586
2582
  function mergeDeepProperties(a, b, caseless) {
2587
- if (!utils.isUndefined(b)) {
2583
+ if (!utils$1.isUndefined(b)) {
2588
2584
  return getMergedValue(a, b, caseless);
2589
- } else if (!utils.isUndefined(a)) {
2585
+ } else if (!utils$1.isUndefined(a)) {
2590
2586
  return getMergedValue(undefined, a, caseless);
2591
2587
  }
2592
2588
  }
2593
2589
 
2594
2590
  // eslint-disable-next-line consistent-return
2595
2591
  function valueFromConfig2(a, b) {
2596
- if (!utils.isUndefined(b)) {
2592
+ if (!utils$1.isUndefined(b)) {
2597
2593
  return getMergedValue(undefined, b);
2598
2594
  }
2599
2595
  }
2600
2596
 
2601
2597
  // eslint-disable-next-line consistent-return
2602
2598
  function defaultToConfig2(a, b) {
2603
- if (!utils.isUndefined(b)) {
2599
+ if (!utils$1.isUndefined(b)) {
2604
2600
  return getMergedValue(undefined, b);
2605
- } else if (!utils.isUndefined(a)) {
2601
+ } else if (!utils$1.isUndefined(a)) {
2606
2602
  return getMergedValue(undefined, a);
2607
2603
  }
2608
2604
  }
@@ -2627,6 +2623,7 @@ function mergeConfig$1(config1, config2) {
2627
2623
  timeout: defaultToConfig2,
2628
2624
  timeoutMessage: defaultToConfig2,
2629
2625
  withCredentials: defaultToConfig2,
2626
+ withXSRFToken: defaultToConfig2,
2630
2627
  adapter: defaultToConfig2,
2631
2628
  responseType: defaultToConfig2,
2632
2629
  xsrfCookieName: defaultToConfig2,
@@ -2647,16 +2644,16 @@ function mergeConfig$1(config1, config2) {
2647
2644
  headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
2648
2645
  };
2649
2646
 
2650
- utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
2647
+ utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
2651
2648
  const merge = mergeMap[prop] || mergeDeepProperties;
2652
2649
  const configValue = merge(config1[prop], config2[prop], prop);
2653
- (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
2650
+ (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
2654
2651
  });
2655
2652
 
2656
2653
  return config;
2657
2654
  }
2658
2655
 
2659
- const VERSION$1 = "1.6.0";
2656
+ const VERSION$1 = "1.6.2";
2660
2657
 
2661
2658
  const validators$1 = {};
2662
2659
 
@@ -2794,7 +2791,7 @@ class Axios$1 {
2794
2791
  }
2795
2792
 
2796
2793
  if (paramsSerializer != null) {
2797
- if (utils.isFunction(paramsSerializer)) {
2794
+ if (utils$1.isFunction(paramsSerializer)) {
2798
2795
  config.paramsSerializer = {
2799
2796
  serialize: paramsSerializer
2800
2797
  };
@@ -2810,12 +2807,12 @@ class Axios$1 {
2810
2807
  config.method = (config.method || this.defaults.method || 'get').toLowerCase();
2811
2808
 
2812
2809
  // Flatten headers
2813
- let contextHeaders = headers && utils.merge(
2810
+ let contextHeaders = headers && utils$1.merge(
2814
2811
  headers.common,
2815
2812
  headers[config.method]
2816
2813
  );
2817
2814
 
2818
- headers && utils.forEach(
2815
+ headers && utils$1.forEach(
2819
2816
  ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
2820
2817
  (method) => {
2821
2818
  delete headers[method];
@@ -2902,7 +2899,7 @@ class Axios$1 {
2902
2899
  }
2903
2900
 
2904
2901
  // Provide aliases for supported request methods
2905
- utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
2902
+ utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
2906
2903
  /*eslint func-names:0*/
2907
2904
  Axios$1.prototype[method] = function(url, config) {
2908
2905
  return this.request(mergeConfig$1(config || {}, {
@@ -2913,7 +2910,7 @@ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData
2913
2910
  };
2914
2911
  });
2915
2912
 
2916
- utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
2913
+ utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
2917
2914
  /*eslint func-names:0*/
2918
2915
 
2919
2916
  function generateHTTPMethod(isForm) {
@@ -3089,7 +3086,7 @@ function spread$1(callback) {
3089
3086
  * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
3090
3087
  */
3091
3088
  function isAxiosError$1(payload) {
3092
- return utils.isObject(payload) && (payload.isAxiosError === true);
3089
+ return utils$1.isObject(payload) && (payload.isAxiosError === true);
3093
3090
  }
3094
3091
 
3095
3092
  const HttpStatusCode$1 = {
@@ -3176,10 +3173,10 @@ function createInstance(defaultConfig) {
3176
3173
  const instance = bind(Axios$2.prototype.request, context);
3177
3174
 
3178
3175
  // Copy axios.prototype to instance
3179
- utils.extend(instance, Axios$2.prototype, context, {allOwnKeys: true});
3176
+ utils$1.extend(instance, Axios$2.prototype, context, {allOwnKeys: true});
3180
3177
 
3181
3178
  // Copy context to instance
3182
- utils.extend(instance, context, null, {allOwnKeys: true});
3179
+ utils$1.extend(instance, context, null, {allOwnKeys: true});
3183
3180
 
3184
3181
  // Factory for creating new instances
3185
3182
  instance.create = function create(instanceConfig) {
@@ -3223,7 +3220,7 @@ axios.mergeConfig = mergeConfig$1;
3223
3220
 
3224
3221
  axios.AxiosHeaders = AxiosHeaders$2;
3225
3222
 
3226
- axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
3223
+ axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
3227
3224
 
3228
3225
  axios.getAdapter = adapters.getAdapter;
3229
3226