axios 0.28.1 → 0.30.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,78 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.30.0](https://github.com/axios/axios/compare/v0.29.0...v0.30.0) (2025-03-26)
4
+
5
+ ## Release notes:
6
+
7
+ ### Bug Fixes
8
+
9
+ - fix: modify log while request is aborted ([#4917](https://github.com/axios/axios/pull/4917))
10
+ - fix: update CHANGELOG.md for v0.x ([#6271](https://github.com/axios/axios/pull/6271))
11
+ - fix: modify upgrade guide for 0.28.1's breaking change ([#6787](https://github.com/axios/axios/pull/6787))
12
+ - fix: backport allowAbsoluteUrls vulnerability fix to v0.x ([#6829](https://github.com/axios/axios/pull/6829))
13
+ - fix: add allowAbsoluteUrls type ([#6849](https://github.com/axios/axios/pull/6849))
14
+
15
+ ## [0.29.0](https://github.com/axios/axios/compare/v0.28.1...v0.29.0) (2024-11-21)
16
+
17
+ ## Release notes:
18
+
19
+ ### Bug Fixes
20
+
21
+ - fix(backport): backport security fixes in commits #6167 and #6163 (#6402)
22
+ - fix: omit nulls in params (#6394)
23
+ - fix(backport): fix paramsSerializer function validation (#6361)
24
+ - fix: regular expression denial of service (ReDoS) (#6708)
25
+
3
26
  ## [0.28.1](https://github.com/axios/axios/compare/v0.28.0...v0.28.1) (2024-03-24)
4
27
 
5
28
  ## Release notes:
29
+
6
30
  ### Bug Fixes
7
31
 
8
- * fix(backport): custom params serializer support (#6263)
9
- * fix(backport): uncaught ReferenceError `req` is not defined (#6307)
32
+ - fix(backport): custom params serializer support (#6263)
33
+ - fix(backport): uncaught ReferenceError `req` is not defined (#6307)
10
34
 
11
35
  ## [0.28.0](https://github.com/axios/axios/compare/v0.27.2...v0.28.0) (2024-02-12)
12
36
 
13
37
  ## Release notes:
38
+
14
39
  ### Bug Fixes
15
40
 
16
- * fix(security): fixed CVE-2023-45857 by backporting `withXSRFToken` option to v0.x (#6091)
41
+ - fix(security): fixed CVE-2023-45857 by backporting `withXSRFToken` option to v0.x ([#6091](https://github.com/axios/axios/pull/6091))
17
42
 
18
43
  ### Backports from v1.x:
19
44
 
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)
45
+ - Allow null indexes on formSerializer and paramsSerializer v0.x ([#4961](https://github.com/axios/axios/pull/4961))
46
+ - Fixing content-type header repeated ([#4745](https://github.com/axios/axios/pull/4745))
47
+ - Fixed timeout error message for HTTP ([#4738](https://github.com/axios/axios/pull/4738))
48
+ - Added `axios.formToJSON` method ([#4735](https://github.com/axios/axios/pull/4735))
49
+ - URL params serializer ([#4734](https://github.com/axios/axios/pull/4734))
50
+ - Fixed toFormData Blob issue on node>v17 ([#4728](https://github.com/axios/axios/pull/4728))
51
+ - Adding types for progress event callbacks ([#4675](https://github.com/axios/axios/pull/4675))
52
+ - Fixed max body length defaults ([#4731](https://github.com/axios/axios/pull/4731))
53
+ - Added data URL support for node.js ([#4725](https://github.com/axios/axios/pull/4725))
54
+ - Added isCancel type assert ([#4293](https://github.com/axios/axios/pull/4293))
55
+ - Added the ability for the `url-encoded-form` serializer to respect the `formSerializer` config ([#4721](https://github.com/axios/axios/pull/4721))
56
+ - Add `string[]` to `AxiosRequestHeaders` type ([#4322](https://github.com/axios/axios/pull/4224))
57
+ - Allow type definition for axios instance methods ([#4224](https://github.com/axios/axios/pull/4224))
58
+ - Fixed `AxiosError` stack capturing; ([#4718](https://github.com/axios/axios/pull/4718))
59
+ - Fixed `AxiosError` status code type; ([#4717](https://github.com/axios/axios/pull/4717))
60
+ - Adding Canceler parameters config and request ([#4711](https://github.com/axios/axios/pull/4711))
61
+ - fix(types): allow to specify partial default headers for instance creation ([#4185](https://github.com/axios/axios/pull/4185))
62
+ - Added `blob` to the list of protocols supported by the browser ([#4678](https://github.com/axios/axios/pull/4678))
63
+ - Fixing Z_BUF_ERROR when no content ([#4701](https://github.com/axios/axios/pull/4701))
64
+ - Fixed race condition on immediate requests cancellation ([#4261](https://github.com/axios/axios/pull/4261))
65
+ - 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 ([#4248](https://github.com/axios/axios/pull/4248))
66
+ - Added generic AxiosAbortSignal TS interface to avoid importing AbortController polyfill ([#4229](https://github.com/axios/axios/pull/4229))
67
+ - Fix TS definition for AxiosRequestTransformer ([#4201](https://github.com/axios/axios/pull/4201))
68
+ - Use type alias instead of interface for AxiosPromise ([#4505](https://github.com/axios/axios/pull/4505))
69
+ - Include request and config when creating a CanceledError instance ([#4659](https://github.com/axios/axios/pull/4659))
70
+ - Added generic TS types for the exposed toFormData helper ([#4668](https://github.com/axios/axios/pull/4668))
71
+ - Optimized the code that checks cancellation ([#4587](https://github.com/axios/axios/pull/4587))
72
+ - Replaced webpack with rollup ([#4596](https://github.com/axios/axios/pull/4596))
73
+ - Added stack trace to AxiosError ([#4624](https://github.com/axios/axios/pull/4624))
74
+ - Updated AxiosError.config to be optional in the type definition ([#4665](https://github.com/axios/axios/pull/4665))
75
+ - Removed incorrect argument for NetworkError constructor ([#4656](https://github.com/axios/axios/pull/4656))
51
76
 
52
77
  ## 0.27.2 (April 27, 2022)
53
78
 
@@ -70,9 +95,9 @@ Breaking changes:
70
95
 
71
96
  - 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
97
  - 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))
98
+ - **(\*)** 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
99
  - 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))
100
+ - **(\*)** Improved and fixed multiple issues with FormData support ([#4448](https://github.com/axios/axios/pull/4448))
76
101
 
77
102
  QOL and DevX improvements:
78
103
 
@@ -93,7 +118,7 @@ Documentation:
93
118
 
94
119
  Notes:
95
120
 
96
- - **(*)** Please read these pull requests before updating, these changes are very impactful and far reaching.
121
+ - **(\*)** Please read these pull requests before updating, these changes are very impactful and far reaching.
97
122
 
98
123
  ## 0.26.1 (March 9, 2022)
99
124
 
package/UPGRADE_GUIDE.md CHANGED
@@ -167,3 +167,24 @@ require(['bower_components/axios/dist/axios'], function (axios) {
167
167
  // CommonJS
168
168
  var axios = require('axios/dist/axios');
169
169
  ```
170
+
171
+ ## 0.28.x -> 0.28.1
172
+
173
+ The way to pass in a custom parameter serializer has changed
174
+
175
+ 0.28.0
176
+ ```js
177
+ axios.create({
178
+ paramsSerializer: (params) => {
179
+ return qs.stringify(params, { arrayFormat: 'repeat', skipNulls: true })
180
+ }, ...config);
181
+ ```
182
+ now the serializer needs to be in under a new key:
183
+
184
+ 0.28.1
185
+ ```js
186
+ axios.create({
187
+ paramsSerializer: {
188
+ serialize: (params) => qs.stringify(params, { arrayFormat: 'repeat', skipNulls: true }),
189
+ }, ...config);
190
+ ```
package/dist/axios.js CHANGED
@@ -1,4 +1,4 @@
1
- // axios v0.28.1 Copyright (c) 2024 Matt Zabriskie
1
+ // axios v0.30.0 Copyright (c) 2025 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
 
@@ -1171,10 +1174,13 @@
1171
1174
  *
1172
1175
  * @param {string} baseURL The base URL
1173
1176
  * @param {string} requestedURL Absolute or relative URL to combine
1177
+ * @param {boolean} allowAbsoluteUrls Set to true to allow absolute URLs
1178
+ *
1174
1179
  * @returns {string} The combined full path
1175
1180
  */
1176
- var buildFullPath = function buildFullPath(baseURL, requestedURL) {
1177
- if (baseURL && !isAbsoluteURL(requestedURL)) {
1181
+ var buildFullPath = function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
1182
+ var isRelativeURL = !isAbsoluteURL(requestedURL);
1183
+ if (baseURL && (isRelativeURL || allowAbsoluteUrls === false)) {
1178
1184
  return combineURLs(baseURL, requestedURL);
1179
1185
  }
1180
1186
  return requestedURL;
@@ -1350,7 +1356,7 @@
1350
1356
  requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
1351
1357
  }
1352
1358
 
1353
- var fullPath = buildFullPath(config.baseURL, config.url);
1359
+ var fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
1354
1360
 
1355
1361
  request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
1356
1362
 
@@ -1907,7 +1913,7 @@
1907
1913
  };
1908
1914
 
1909
1915
  var data = {
1910
- "version": "0.28.1"
1916
+ "version": "0.30.0"
1911
1917
  };
1912
1918
 
1913
1919
  var VERSION = data.version;
@@ -2048,15 +2054,19 @@
2048
2054
 
2049
2055
  var paramsSerializer = config.paramsSerializer;
2050
2056
 
2051
- if (paramsSerializer !== undefined) {
2052
- validator.assertOptions(paramsSerializer, {
2053
- encode: validators.function,
2054
- serialize: validators.function
2055
- }, true);
2057
+ if (paramsSerializer != null) {
2058
+ if (utils.isFunction(paramsSerializer)) {
2059
+ config.paramsSerializer = {
2060
+ serialize: paramsSerializer
2061
+ };
2062
+ } else {
2063
+ validator.assertOptions(paramsSerializer, {
2064
+ encode: validators.function,
2065
+ serialize: validators.function
2066
+ }, true);
2067
+ }
2056
2068
  }
2057
2069
 
2058
- utils.isFunction(paramsSerializer) && (config.paramsSerializer = {serialize: paramsSerializer});
2059
-
2060
2070
  // filter out skipped interceptors
2061
2071
  var requestInterceptorChain = [];
2062
2072
  var synchronousRequestInterceptors = true;
@@ -2119,7 +2129,7 @@
2119
2129
 
2120
2130
  Axios.prototype.getUri = function getUri(config) {
2121
2131
  config = mergeConfig(this.defaults, config);
2122
- var fullPath = buildFullPath(config.baseURL, config.url);
2132
+ var fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
2123
2133
  return buildURL(fullPath, config.params, config.paramsSerializer);
2124
2134
  };
2125
2135