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/lib/env/data.js CHANGED
@@ -1,3 +1,3 @@
1
1
  module.exports = {
2
- "version": "0.28.0"
2
+ "version": "0.29.0"
3
3
  };
@@ -35,12 +35,20 @@ module.exports = function buildURL(url, params, options) {
35
35
 
36
36
  var _encode = options && options.encode || encode;
37
37
 
38
- var serializerParams = utils.isURLSearchParams(params) ?
39
- params.toString() :
40
- new AxiosURLSearchParams(params, options).toString(_encode);
38
+ var serializeFn = options && options.serialize;
41
39
 
42
- if (serializerParams) {
43
- url += (url.indexOf('?') === -1 ? '?' : '&') + serializerParams;
40
+ var serializedParams;
41
+
42
+ if (serializeFn) {
43
+ serializedParams = serializeFn(params, options);
44
+ } else {
45
+ serializedParams = utils.isURLSearchParams(params) ?
46
+ params.toString() :
47
+ new AxiosURLSearchParams(params, options).toString(_encode);
48
+ }
49
+
50
+ if (serializedParams) {
51
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
44
52
  }
45
53
 
46
54
  return url;
@@ -9,6 +9,6 @@
9
9
  */
10
10
  module.exports = function combineURLs(baseURL, relativeURL) {
11
11
  return relativeURL
12
- ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
12
+ ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
13
13
  : baseURL;
14
14
  };
@@ -28,6 +28,9 @@ function arrayToObject(arr) {
28
28
  function formDataToJSON(formData) {
29
29
  function buildPath(path, value, target, index) {
30
30
  var name = path[index++];
31
+
32
+ if (name === '__proto__') return true;
33
+
31
34
  var isNumericKey = Number.isFinite(+name);
32
35
  var isLast = index >= path.length;
33
36
  name = !name && utils.isArray(target) ? target.length : name;
@@ -118,7 +118,7 @@ function toFormData(obj, formData, options) {
118
118
  key = removeBrackets(key);
119
119
 
120
120
  arr.forEach(function each(el, index) {
121
- !utils.isUndefined(el) && formData.append(
121
+ !(utils.isUndefined(el) || el === null) && formData.append(
122
122
  // eslint-disable-next-line no-nested-ternary
123
123
  indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
124
124
  convertValue(el)
@@ -155,7 +155,7 @@ function toFormData(obj, formData, options) {
155
155
  stack.push(value);
156
156
 
157
157
  utils.forEach(value, function each(el, key) {
158
- var result = !utils.isUndefined(el) && visitor.call(
158
+ var result = !(utils.isUndefined(el) || el === null) && visitor.call(
159
159
  formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
160
160
  );
161
161
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "axios",
3
- "version": "0.28.0",
3
+ "version": "0.29.0",
4
4
  "description": "Promise based HTTP client for the browser and node.js",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -87,7 +87,7 @@
87
87
  "unpkg": "dist/axios.min.js",
88
88
  "typings": "./index.d.ts",
89
89
  "dependencies": {
90
- "follow-redirects": "^1.15.0",
90
+ "follow-redirects": "^1.15.4",
91
91
  "form-data": "^4.0.0",
92
92
  "proxy-from-env": "^1.1.0"
93
93
  },
@@ -97,4 +97,4 @@
97
97
  "threshold": "5kB"
98
98
  }
99
99
  ]
100
- }
100
+ }