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 +62 -37
- package/UPGRADE_GUIDE.md +21 -0
- package/dist/axios.js +26 -16
- package/dist/axios.js.map +1 -1
- package/dist/axios.min.js +1 -1
- package/dist/axios.min.js.map +1 -1
- package/dist/esm/axios.js +26 -16
- package/dist/esm/axios.js.map +1 -1
- package/dist/esm/axios.min.js +1 -1
- package/dist/esm/axios.min.js.map +1 -1
- package/index.d.ts +1 -0
- package/lib/adapters/http.js +3 -3
- package/lib/adapters/xhr.js +1 -1
- package/lib/core/Axios.js +12 -8
- package/lib/core/buildFullPath.js +5 -2
- package/lib/env/data.js +1 -1
- package/lib/helpers/combineURLs.js +1 -1
- package/lib/helpers/formDataToJSON.js +3 -0
- package/lib/helpers/toFormData.js +2 -2
- package/package.json +3 -3
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
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
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
|
-
|
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
@@ -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.
|
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.
|
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
|
+
}
|