axios 0.30.2 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/axios.js CHANGED
@@ -1,4 +1,4 @@
1
- // axios v0.30.2 Copyright (c) 2025 Matt Zabriskie
1
+ // axios v0.31.0 Copyright (c) 2026 Matt Zabriskie
2
2
  var bind = function bind(fn, thisArg) {
3
3
  return function wrap() {
4
4
  return fn.apply(thisArg, arguments);
@@ -134,7 +134,15 @@ function isPlainObject(val) {
134
134
  * @return {boolean} True if value is a empty Object, otherwise false
135
135
  */
136
136
  function isEmptyObject(val) {
137
- return val && Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
137
+ if (!isPlainObject(val)) {
138
+ return false;
139
+ }
140
+ for (var key in val) {
141
+ if (Object.prototype.hasOwnProperty.call(val, key)) {
142
+ return false;
143
+ }
144
+ }
145
+ return true;
138
146
  }
139
147
 
140
148
  /**
@@ -313,6 +321,10 @@ function forEach(obj, fn) {
313
321
  function merge(/* obj1, obj2, obj3, ... */) {
314
322
  var result = {};
315
323
  function assignValue(val, key) {
324
+ if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
325
+ return;
326
+ }
327
+
316
328
  if (isPlainObject(result[key]) && isPlainObject(val)) {
317
329
  result[key] = merge(result[key], val);
318
330
  } else if (isPlainObject(val)) {
@@ -1720,6 +1732,25 @@ var isCancel = function isCancel(value) {
1720
1732
  return !!(value && value.__CANCEL__);
1721
1733
  };
1722
1734
 
1735
+ var INVALID_HEADER_VALUE_RE = /[^\x09\x20-\x7E\x80-\xFF]/g;
1736
+ var BOUNDARY_WHITESPACE_RE = /^[\x09\x20]+|[\x09\x20]+$/g;
1737
+
1738
+ function sanitizeHeaderValue(value) {
1739
+ if (value === false || value == null) {
1740
+ return value;
1741
+ }
1742
+
1743
+ if (utils.isArray(value)) {
1744
+ return value.map(sanitizeHeaderValue);
1745
+ }
1746
+
1747
+ return String(value)
1748
+ .replace(INVALID_HEADER_VALUE_RE, '')
1749
+ .replace(BOUNDARY_WHITESPACE_RE, '');
1750
+ }
1751
+
1752
+ var sanitizeHeaderValue_1 = sanitizeHeaderValue;
1753
+
1723
1754
  /**
1724
1755
  * Throws a `CanceledError` if cancellation has been requested.
1725
1756
  */
@@ -1771,6 +1802,10 @@ var dispatchRequest = function dispatchRequest(config) {
1771
1802
  }
1772
1803
  );
1773
1804
 
1805
+ utils.forEach(config.headers, function sanitizeHeaderConfigValue(value, header) {
1806
+ config.headers[header] = sanitizeHeaderValue_1(value);
1807
+ });
1808
+
1774
1809
  var adapter = config.adapter || defaults_1.adapter;
1775
1810
 
1776
1811
  return adapter(config).then(function onAdapterResolution(response) {
@@ -1898,7 +1933,10 @@ var mergeConfig = function mergeConfig(config1, config2) {
1898
1933
  };
1899
1934
 
1900
1935
  utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
1901
- var merge = mergeMap[prop] || mergeDeepProperties;
1936
+ if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') {
1937
+ return;
1938
+ }
1939
+ var merge = utils.hasOwnProperty(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
1902
1940
  var configValue = merge(prop);
1903
1941
  (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
1904
1942
  });
@@ -1907,7 +1945,7 @@ var mergeConfig = function mergeConfig(config1, config2) {
1907
1945
  };
1908
1946
 
1909
1947
  var data = {
1910
- "version": "0.30.2"
1948
+ "version": "0.31.0"
1911
1949
  };
1912
1950
 
1913
1951
  var VERSION = data.version;