axios 0.28.1 → 0.29.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/CHANGELOG.md CHANGED
@@ -1,53 +1,66 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.29.0](https://github.com/axios/axios/compare/v0.28.1...v0.29.0) (2024-11-21)
4
+
5
+ ## Release notes:
6
+
7
+ ### Bug Fixes
8
+
9
+ - fix(backport): backport security fixes in commits #6167 and #6163 (#6402)
10
+ - fix: omit nulls in params (#6394)
11
+ - fix(backport): fix paramsSerializer function validation (#6361)
12
+ - fix: regular expression denial of service (ReDoS) (#6708)
13
+
3
14
  ## [0.28.1](https://github.com/axios/axios/compare/v0.28.0...v0.28.1) (2024-03-24)
4
15
 
5
16
  ## Release notes:
17
+
6
18
  ### Bug Fixes
7
19
 
8
- * fix(backport): custom params serializer support (#6263)
9
- * fix(backport): uncaught ReferenceError `req` is not defined (#6307)
20
+ - fix(backport): custom params serializer support (#6263)
21
+ - fix(backport): uncaught ReferenceError `req` is not defined (#6307)
10
22
 
11
23
  ## [0.28.0](https://github.com/axios/axios/compare/v0.27.2...v0.28.0) (2024-02-12)
12
24
 
13
25
  ## Release notes:
26
+
14
27
  ### Bug Fixes
15
28
 
16
- * fix(security): fixed CVE-2023-45857 by backporting `withXSRFToken` option to v0.x (#6091)
29
+ - fix(security): fixed CVE-2023-45857 by backporting `withXSRFToken` option to v0.x (#6091)
17
30
 
18
31
  ### Backports from v1.x:
19
32
 
20
- * Allow null indexes on formSerializer and paramsSerializer v0.x (#4961)
21
- * Fixing content-type header repeated #4745
22
- * Fixed timeout error message for HTTP 4738
23
- * Added `axios.formToJSON` method (#4735)
24
- * URL params serializer (#4734)
25
- * Fixed toFormData Blob issue on node>v17 #4728
26
- * Adding types for progress event callbacks #4675
27
- * Fixed max body length defaults #4731
28
- * Added data URL support for node.js (#4725)
29
- * Added isCancel type assert (#4293)
30
- * Added the ability for the `url-encoded-form` serializer to respect the `formSerializer` config (#4721)
31
- * Add `string[]` to `AxiosRequestHeaders` type (#4322)
32
- * Allow type definition for axios instance methods (#4224)
33
- * Fixed `AxiosError` stack capturing; (#4718)
34
- * Fixed `AxiosError` status code type; (#4717)
35
- * Adding Canceler parameters config and request (#4711)
36
- * fix(types): allow to specify partial default headers for instance creation (#4185)
37
- * Added `blob` to the list of protocols supported by the browser (#4678)
38
- * Fixing Z_BUF_ERROR when no content (#4701)
39
- * Fixed race condition on immediate requests cancellation (#4261)
40
- * Added a clear() function to the request and response interceptors object so a user can ensure that all interceptors have been removed from an Axios instance https://github.com/axios/axios/pull/4248
41
- * Added generic AxiosAbortSignal TS interface to avoid importing AbortController polyfill (#4229)
42
- * Fix TS definition for AxiosRequestTransformer (#4201)
43
- * Use type alias instead of interface for AxiosPromise (#4505)
44
- * Include request and config when creating a CanceledError instance (#4659)
45
- * Added generic TS types for the exposed toFormData helper (#4668)
46
- * Optimized the code that checks cancellation (#4587)
47
- * Replaced webpack with rollup (#4596)
48
- * Added stack trace to AxiosError (#4624)
49
- * Updated AxiosError.config to be optional in the type definition (#4665)
50
- * Removed incorrect argument for NetworkError constructor (#4656)
33
+ - Allow null indexes on formSerializer and paramsSerializer v0.x (#4961)
34
+ - Fixing content-type header repeated #4745
35
+ - Fixed timeout error message for HTTP 4738
36
+ - Added `axios.formToJSON` method (#4735)
37
+ - URL params serializer (#4734)
38
+ - Fixed toFormData Blob issue on node>v17 #4728
39
+ - Adding types for progress event callbacks #4675
40
+ - Fixed max body length defaults #4731
41
+ - Added data URL support for node.js (#4725)
42
+ - Added isCancel type assert (#4293)
43
+ - Added the ability for the `url-encoded-form` serializer to respect the `formSerializer` config (#4721)
44
+ - Add `string[]` to `AxiosRequestHeaders` type (#4322)
45
+ - Allow type definition for axios instance methods (#4224)
46
+ - Fixed `AxiosError` stack capturing; (#4718)
47
+ - Fixed `AxiosError` status code type; (#4717)
48
+ - Adding Canceler parameters config and request (#4711)
49
+ - fix(types): allow to specify partial default headers for instance creation (#4185)
50
+ - Added `blob` to the list of protocols supported by the browser (#4678)
51
+ - Fixing Z_BUF_ERROR when no content (#4701)
52
+ - Fixed race condition on immediate requests cancellation (#4261)
53
+ - Added a clear() function to the request and response interceptors object so a user can ensure that all interceptors have been removed from an Axios instance https://github.com/axios/axios/pull/4248
54
+ - Added generic AxiosAbortSignal TS interface to avoid importing AbortController polyfill (#4229)
55
+ - Fix TS definition for AxiosRequestTransformer (#4201)
56
+ - Use type alias instead of interface for AxiosPromise (#4505)
57
+ - Include request and config when creating a CanceledError instance (#4659)
58
+ - Added generic TS types for the exposed toFormData helper (#4668)
59
+ - Optimized the code that checks cancellation (#4587)
60
+ - Replaced webpack with rollup (#4596)
61
+ - Added stack trace to AxiosError (#4624)
62
+ - Updated AxiosError.config to be optional in the type definition (#4665)
63
+ - Removed incorrect argument for NetworkError constructor (#4656)
51
64
 
52
65
  ## 0.27.2 (April 27, 2022)
53
66
 
@@ -70,9 +83,9 @@ Breaking changes:
70
83
 
71
84
  - New toFormData helper function that allows the implementor to pass an object and allow axios to convert it to FormData ([#3757](https://github.com/axios/axios/pull/3757))
72
85
  - Removed functionality that removed the the `Content-Type` request header when passing FormData ([#3785](https://github.com/axios/axios/pull/3785))
73
- - **(*)** Refactored error handling implementing AxiosError as a constructor, this is a large change to error handling on the whole ([#3645](https://github.com/axios/axios/pull/3645))
86
+ - **(\*)** Refactored error handling implementing AxiosError as a constructor, this is a large change to error handling on the whole ([#3645](https://github.com/axios/axios/pull/3645))
74
87
  - Separated responsibility for FormData instantiation between `transformRequest` and `toFormData` ([#4470](https://github.com/axios/axios/pull/4470))
75
- - **(*)** Improved and fixed multiple issues with FormData support ([#4448](https://github.com/axios/axios/pull/4448))
88
+ - **(\*)** Improved and fixed multiple issues with FormData support ([#4448](https://github.com/axios/axios/pull/4448))
76
89
 
77
90
  QOL and DevX improvements:
78
91
 
@@ -93,7 +106,7 @@ Documentation:
93
106
 
94
107
  Notes:
95
108
 
96
- - **(*)** Please read these pull requests before updating, these changes are very impactful and far reaching.
109
+ - **(\*)** Please read these pull requests before updating, these changes are very impactful and far reaching.
97
110
 
98
111
  ## 0.26.1 (March 9, 2022)
99
112
 
package/dist/axios.js CHANGED
@@ -1,4 +1,4 @@
1
- // axios v0.28.1 Copyright (c) 2024 Matt Zabriskie
1
+ // axios v0.29.0 Copyright (c) 2024 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) :
@@ -744,7 +744,7 @@
744
744
  key = removeBrackets(key);
745
745
 
746
746
  arr.forEach(function each(el, index) {
747
- !utils.isUndefined(el) && formData.append(
747
+ !(utils.isUndefined(el) || el === null) && formData.append(
748
748
  // eslint-disable-next-line no-nested-ternary
749
749
  indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
750
750
  convertValue(el)
@@ -781,7 +781,7 @@
781
781
  stack.push(value);
782
782
 
783
783
  utils.forEach(value, function each(el, key) {
784
- var result = !utils.isUndefined(el) && visitor.call(
784
+ var result = !(utils.isUndefined(el) || el === null) && visitor.call(
785
785
  formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
786
786
  );
787
787
 
@@ -1024,6 +1024,9 @@
1024
1024
  function formDataToJSON(formData) {
1025
1025
  function buildPath(path, value, target, index) {
1026
1026
  var name = path[index++];
1027
+
1028
+ if (name === '__proto__') return true;
1029
+
1027
1030
  var isNumericKey = Number.isFinite(+name);
1028
1031
  var isLast = index >= path.length;
1029
1032
  name = !name && utils.isArray(target) ? target.length : name;
@@ -1160,7 +1163,7 @@
1160
1163
  */
1161
1164
  var combineURLs = function combineURLs(baseURL, relativeURL) {
1162
1165
  return relativeURL
1163
- ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
1166
+ ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
1164
1167
  : baseURL;
1165
1168
  };
1166
1169
 
@@ -1907,7 +1910,7 @@
1907
1910
  };
1908
1911
 
1909
1912
  var data = {
1910
- "version": "0.28.1"
1913
+ "version": "0.29.0"
1911
1914
  };
1912
1915
 
1913
1916
  var VERSION = data.version;
@@ -2048,15 +2051,19 @@
2048
2051
 
2049
2052
  var paramsSerializer = config.paramsSerializer;
2050
2053
 
2051
- if (paramsSerializer !== undefined) {
2052
- validator.assertOptions(paramsSerializer, {
2053
- encode: validators.function,
2054
- serialize: validators.function
2055
- }, true);
2054
+ if (paramsSerializer != null) {
2055
+ if (utils.isFunction(paramsSerializer)) {
2056
+ config.paramsSerializer = {
2057
+ serialize: paramsSerializer
2058
+ };
2059
+ } else {
2060
+ validator.assertOptions(paramsSerializer, {
2061
+ encode: validators.function,
2062
+ serialize: validators.function
2063
+ }, true);
2064
+ }
2056
2065
  }
2057
2066
 
2058
- utils.isFunction(paramsSerializer) && (config.paramsSerializer = {serialize: paramsSerializer});
2059
-
2060
2067
  // filter out skipped interceptors
2061
2068
  var requestInterceptorChain = [];
2062
2069
  var synchronousRequestInterceptors = true;