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/lib/core/Axios.js CHANGED
@@ -61,15 +61,19 @@ Axios.prototype.request = function request(configOrUrl, config) {
61
61
 
62
62
  var paramsSerializer = config.paramsSerializer;
63
63
 
64
- if (paramsSerializer !== undefined) {
65
- validator.assertOptions(paramsSerializer, {
66
- encode: validators.function,
67
- serialize: validators.function
68
- }, true);
64
+ if (paramsSerializer != null) {
65
+ if (utils.isFunction(paramsSerializer)) {
66
+ config.paramsSerializer = {
67
+ serialize: paramsSerializer
68
+ };
69
+ } else {
70
+ validator.assertOptions(paramsSerializer, {
71
+ encode: validators.function,
72
+ serialize: validators.function
73
+ }, true);
74
+ }
69
75
  }
70
76
 
71
- utils.isFunction(paramsSerializer) && (config.paramsSerializer = {serialize: paramsSerializer});
72
-
73
77
  // filter out skipped interceptors
74
78
  var requestInterceptorChain = [];
75
79
  var synchronousRequestInterceptors = true;
@@ -132,7 +136,7 @@ Axios.prototype.request = function request(configOrUrl, config) {
132
136
 
133
137
  Axios.prototype.getUri = function getUri(config) {
134
138
  config = mergeConfig(this.defaults, config);
135
- var fullPath = buildFullPath(config.baseURL, config.url);
139
+ var fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
136
140
  return buildURL(fullPath, config.params, config.paramsSerializer);
137
141
  };
138
142
 
@@ -10,10 +10,13 @@ var combineURLs = require('../helpers/combineURLs');
10
10
  *
11
11
  * @param {string} baseURL The base URL
12
12
  * @param {string} requestedURL Absolute or relative URL to combine
13
+ * @param {boolean} allowAbsoluteUrls Set to true to allow absolute URLs
14
+ *
13
15
  * @returns {string} The combined full path
14
16
  */
15
- module.exports = function buildFullPath(baseURL, requestedURL) {
16
- if (baseURL && !isAbsoluteURL(requestedURL)) {
17
+ module.exports = function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
18
+ var isRelativeURL = !isAbsoluteURL(requestedURL);
19
+ if (baseURL && (isRelativeURL || allowAbsoluteUrls === false)) {
17
20
  return combineURLs(baseURL, requestedURL);
18
21
  }
19
22
  return requestedURL;
package/lib/env/data.js CHANGED
@@ -1,3 +1,3 @@
1
1
  module.exports = {
2
- "version": "0.28.1"
2
+ "version": "0.30.0"
3
3
  };
@@ -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.1",
3
+ "version": "0.30.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
+ }