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/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
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -140,7 +140,15 @@
140
140
  * @return {boolean} True if value is a empty Object, otherwise false
141
141
  */
142
142
  function isEmptyObject(val) {
143
- return val && Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
143
+ if (!isPlainObject(val)) {
144
+ return false;
145
+ }
146
+ for (var key in val) {
147
+ if (Object.prototype.hasOwnProperty.call(val, key)) {
148
+ return false;
149
+ }
150
+ }
151
+ return true;
144
152
  }
145
153
 
146
154
  /**
@@ -319,6 +327,10 @@
319
327
  function merge(/* obj1, obj2, obj3, ... */) {
320
328
  var result = {};
321
329
  function assignValue(val, key) {
330
+ if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
331
+ return;
332
+ }
333
+
322
334
  if (isPlainObject(result[key]) && isPlainObject(val)) {
323
335
  result[key] = merge(result[key], val);
324
336
  } else if (isPlainObject(val)) {
@@ -1726,6 +1738,25 @@
1726
1738
  return !!(value && value.__CANCEL__);
1727
1739
  };
1728
1740
 
1741
+ var INVALID_HEADER_VALUE_RE = /[^\x09\x20-\x7E\x80-\xFF]/g;
1742
+ var BOUNDARY_WHITESPACE_RE = /^[\x09\x20]+|[\x09\x20]+$/g;
1743
+
1744
+ function sanitizeHeaderValue(value) {
1745
+ if (value === false || value == null) {
1746
+ return value;
1747
+ }
1748
+
1749
+ if (utils.isArray(value)) {
1750
+ return value.map(sanitizeHeaderValue);
1751
+ }
1752
+
1753
+ return String(value)
1754
+ .replace(INVALID_HEADER_VALUE_RE, '')
1755
+ .replace(BOUNDARY_WHITESPACE_RE, '');
1756
+ }
1757
+
1758
+ var sanitizeHeaderValue_1 = sanitizeHeaderValue;
1759
+
1729
1760
  /**
1730
1761
  * Throws a `CanceledError` if cancellation has been requested.
1731
1762
  */
@@ -1777,6 +1808,10 @@
1777
1808
  }
1778
1809
  );
1779
1810
 
1811
+ utils.forEach(config.headers, function sanitizeHeaderConfigValue(value, header) {
1812
+ config.headers[header] = sanitizeHeaderValue_1(value);
1813
+ });
1814
+
1780
1815
  var adapter = config.adapter || defaults_1.adapter;
1781
1816
 
1782
1817
  return adapter(config).then(function onAdapterResolution(response) {
@@ -1904,7 +1939,10 @@
1904
1939
  };
1905
1940
 
1906
1941
  utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
1907
- var merge = mergeMap[prop] || mergeDeepProperties;
1942
+ if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') {
1943
+ return;
1944
+ }
1945
+ var merge = utils.hasOwnProperty(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
1908
1946
  var configValue = merge(prop);
1909
1947
  (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
1910
1948
  });
@@ -1913,7 +1951,7 @@
1913
1951
  };
1914
1952
 
1915
1953
  var data = {
1916
- "version": "0.30.2"
1954
+ "version": "0.31.0"
1917
1955
  };
1918
1956
 
1919
1957
  var VERSION = data.version;