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/dist/esm/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
  var bind = function bind(fn, thisArg) {
3
3
  return function wrap() {
4
4
  return fn.apply(thisArg, arguments);
@@ -738,7 +738,7 @@ function toFormData(obj, formData, options) {
738
738
  key = removeBrackets(key);
739
739
 
740
740
  arr.forEach(function each(el, index) {
741
- !utils.isUndefined(el) && formData.append(
741
+ !(utils.isUndefined(el) || el === null) && formData.append(
742
742
  // eslint-disable-next-line no-nested-ternary
743
743
  indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
744
744
  convertValue(el)
@@ -775,7 +775,7 @@ function toFormData(obj, formData, options) {
775
775
  stack.push(value);
776
776
 
777
777
  utils.forEach(value, function each(el, key) {
778
- var result = !utils.isUndefined(el) && visitor.call(
778
+ var result = !(utils.isUndefined(el) || el === null) && visitor.call(
779
779
  formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
780
780
  );
781
781
 
@@ -1018,6 +1018,9 @@ function arrayToObject(arr) {
1018
1018
  function formDataToJSON(formData) {
1019
1019
  function buildPath(path, value, target, index) {
1020
1020
  var name = path[index++];
1021
+
1022
+ if (name === '__proto__') return true;
1023
+
1021
1024
  var isNumericKey = Number.isFinite(+name);
1022
1025
  var isLast = index >= path.length;
1023
1026
  name = !name && utils.isArray(target) ? target.length : name;
@@ -1154,7 +1157,7 @@ var isAbsoluteURL = function isAbsoluteURL(url) {
1154
1157
  */
1155
1158
  var combineURLs = function combineURLs(baseURL, relativeURL) {
1156
1159
  return relativeURL
1157
- ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
1160
+ ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
1158
1161
  : baseURL;
1159
1162
  };
1160
1163
 
@@ -1901,7 +1904,7 @@ var mergeConfig = function mergeConfig(config1, config2) {
1901
1904
  };
1902
1905
 
1903
1906
  var data = {
1904
- "version": "0.28.1"
1907
+ "version": "0.29.0"
1905
1908
  };
1906
1909
 
1907
1910
  var VERSION = data.version;
@@ -2042,15 +2045,19 @@ Axios.prototype.request = function request(configOrUrl, config) {
2042
2045
 
2043
2046
  var paramsSerializer = config.paramsSerializer;
2044
2047
 
2045
- if (paramsSerializer !== undefined) {
2046
- validator.assertOptions(paramsSerializer, {
2047
- encode: validators.function,
2048
- serialize: validators.function
2049
- }, true);
2048
+ if (paramsSerializer != null) {
2049
+ if (utils.isFunction(paramsSerializer)) {
2050
+ config.paramsSerializer = {
2051
+ serialize: paramsSerializer
2052
+ };
2053
+ } else {
2054
+ validator.assertOptions(paramsSerializer, {
2055
+ encode: validators.function,
2056
+ serialize: validators.function
2057
+ }, true);
2058
+ }
2050
2059
  }
2051
2060
 
2052
- utils.isFunction(paramsSerializer) && (config.paramsSerializer = {serialize: paramsSerializer});
2053
-
2054
2061
  // filter out skipped interceptors
2055
2062
  var requestInterceptorChain = [];
2056
2063
  var synchronousRequestInterceptors = true;