axios 0.30.3 → 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.3 Copyright (c) 2026 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
  /**
@@ -1724,6 +1732,25 @@ var isCancel = function isCancel(value) {
1724
1732
  return !!(value && value.__CANCEL__);
1725
1733
  };
1726
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
+
1727
1754
  /**
1728
1755
  * Throws a `CanceledError` if cancellation has been requested.
1729
1756
  */
@@ -1775,6 +1802,10 @@ var dispatchRequest = function dispatchRequest(config) {
1775
1802
  }
1776
1803
  );
1777
1804
 
1805
+ utils.forEach(config.headers, function sanitizeHeaderConfigValue(value, header) {
1806
+ config.headers[header] = sanitizeHeaderValue_1(value);
1807
+ });
1808
+
1778
1809
  var adapter = config.adapter || defaults_1.adapter;
1779
1810
 
1780
1811
  return adapter(config).then(function onAdapterResolution(response) {
@@ -1914,7 +1945,7 @@ var mergeConfig = function mergeConfig(config1, config2) {
1914
1945
  };
1915
1946
 
1916
1947
  var data = {
1917
- version: "0.30.3",
1948
+ "version": "0.31.0"
1918
1949
  };
1919
1950
 
1920
1951
  var VERSION = data.version;