axios 0.28.0 → 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,45 +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
+
14
+ ## [0.28.1](https://github.com/axios/axios/compare/v0.28.0...v0.28.1) (2024-03-24)
15
+
16
+ ## Release notes:
17
+
18
+ ### Bug Fixes
19
+
20
+ - fix(backport): custom params serializer support (#6263)
21
+ - fix(backport): uncaught ReferenceError `req` is not defined (#6307)
22
+
3
23
  ## [0.28.0](https://github.com/axios/axios/compare/v0.27.2...v0.28.0) (2024-02-12)
4
24
 
5
25
  ## Release notes:
26
+
6
27
  ### Bug Fixes
7
28
 
8
- * 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)
9
30
 
10
31
  ### Backports from v1.x:
11
32
 
12
- * Allow null indexes on formSerializer and paramsSerializer v0.x (#4961)
13
- * Fixing content-type header repeated #4745
14
- * Fixed timeout error message for HTTP 4738
15
- * Added `axios.formToJSON` method (#4735)
16
- * URL params serializer (#4734)
17
- * Fixed toFormData Blob issue on node>v17 #4728
18
- * Adding types for progress event callbacks #4675
19
- * Fixed max body length defaults #4731
20
- * Added data URL support for node.js (#4725)
21
- * Added isCancel type assert (#4293)
22
- * Added the ability for the `url-encoded-form` serializer to respect the `formSerializer` config (#4721)
23
- * Add `string[]` to `AxiosRequestHeaders` type (#4322)
24
- * Allow type definition for axios instance methods (#4224)
25
- * Fixed `AxiosError` stack capturing; (#4718)
26
- * Fixed `AxiosError` status code type; (#4717)
27
- * Adding Canceler parameters config and request (#4711)
28
- * fix(types): allow to specify partial default headers for instance creation (#4185)
29
- * Added `blob` to the list of protocols supported by the browser (#4678)
30
- * Fixing Z_BUF_ERROR when no content (#4701)
31
- * Fixed race condition on immediate requests cancellation (#4261)
32
- * 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
33
- * Added generic AxiosAbortSignal TS interface to avoid importing AbortController polyfill (#4229)
34
- * Fix TS definition for AxiosRequestTransformer (#4201)
35
- * Use type alias instead of interface for AxiosPromise (#4505)
36
- * Include request and config when creating a CanceledError instance (#4659)
37
- * Added generic TS types for the exposed toFormData helper (#4668)
38
- * Optimized the code that checks cancellation (#4587)
39
- * Replaced webpack with rollup (#4596)
40
- * Added stack trace to AxiosError (#4624)
41
- * Updated AxiosError.config to be optional in the type definition (#4665)
42
- * 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)
43
64
 
44
65
  ## 0.27.2 (April 27, 2022)
45
66
 
@@ -62,9 +83,9 @@ Breaking changes:
62
83
 
63
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))
64
85
  - Removed functionality that removed the the `Content-Type` request header when passing FormData ([#3785](https://github.com/axios/axios/pull/3785))
65
- - **(*)** 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))
66
87
  - Separated responsibility for FormData instantiation between `transformRequest` and `toFormData` ([#4470](https://github.com/axios/axios/pull/4470))
67
- - **(*)** 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))
68
89
 
69
90
  QOL and DevX improvements:
70
91
 
@@ -85,7 +106,7 @@ Documentation:
85
106
 
86
107
  Notes:
87
108
 
88
- - **(*)** 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.
89
110
 
90
111
  ## 0.26.1 (March 9, 2022)
91
112
 
package/dist/axios.js CHANGED
@@ -1,4 +1,4 @@
1
- // axios v0.28.0 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
 
@@ -875,12 +875,20 @@
875
875
 
876
876
  var _encode = options && options.encode || encode;
877
877
 
878
- var serializerParams = utils.isURLSearchParams(params) ?
879
- params.toString() :
880
- new AxiosURLSearchParams_1(params, options).toString(_encode);
878
+ var serializeFn = options && options.serialize;
881
879
 
882
- if (serializerParams) {
883
- url += (url.indexOf('?') === -1 ? '?' : '&') + serializerParams;
880
+ var serializedParams;
881
+
882
+ if (serializeFn) {
883
+ serializedParams = serializeFn(params, options);
884
+ } else {
885
+ serializedParams = utils.isURLSearchParams(params) ?
886
+ params.toString() :
887
+ new AxiosURLSearchParams_1(params, options).toString(_encode);
888
+ }
889
+
890
+ if (serializedParams) {
891
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
884
892
  }
885
893
 
886
894
  return url;
@@ -1016,6 +1024,9 @@
1016
1024
  function formDataToJSON(formData) {
1017
1025
  function buildPath(path, value, target, index) {
1018
1026
  var name = path[index++];
1027
+
1028
+ if (name === '__proto__') return true;
1029
+
1019
1030
  var isNumericKey = Number.isFinite(+name);
1020
1031
  var isLast = index >= path.length;
1021
1032
  name = !name && utils.isArray(target) ? target.length : name;
@@ -1152,7 +1163,7 @@
1152
1163
  */
1153
1164
  var combineURLs = function combineURLs(baseURL, relativeURL) {
1154
1165
  return relativeURL
1155
- ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
1166
+ ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
1156
1167
  : baseURL;
1157
1168
  };
1158
1169
 
@@ -1495,7 +1506,7 @@
1495
1506
  if (!request) {
1496
1507
  return;
1497
1508
  }
1498
- reject(!cancel || cancel.type ? new CanceledError_1(null, config, req) : cancel);
1509
+ reject(!cancel || cancel.type ? new CanceledError_1(null, config, request) : cancel);
1499
1510
  request.abort();
1500
1511
  request = null;
1501
1512
  };
@@ -1899,7 +1910,7 @@
1899
1910
  };
1900
1911
 
1901
1912
  var data = {
1902
- "version": "0.28.0"
1913
+ "version": "0.29.0"
1903
1914
  };
1904
1915
 
1905
1916
  var VERSION = data.version;
@@ -2040,7 +2051,18 @@
2040
2051
 
2041
2052
  var paramsSerializer = config.paramsSerializer;
2042
2053
 
2043
- utils.isFunction(paramsSerializer) && (config.paramsSerializer = {serialize: paramsSerializer});
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
+ }
2065
+ }
2044
2066
 
2045
2067
  // filter out skipped interceptors
2046
2068
  var requestInterceptorChain = [];