axios 0.27.0 → 0.27.1
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 +7 -1
- package/dist/axios.js +2169 -1468
- package/dist/axios.map +1 -1
- package/dist/axios.min.js +11 -3
- package/dist/axios.min.map +1 -1
- package/lib/adapters/http.js +4 -2
- package/lib/adapters/xhr.js +5 -9
- package/lib/env/data.js +1 -1
- package/lib/utils.js +0 -18
- package/package.json +1 -1
package/lib/adapters/http.js
CHANGED
@@ -17,6 +17,8 @@ var CanceledError = require('../cancel/CanceledError');
|
|
17
17
|
|
18
18
|
var isHttps = /https:?/;
|
19
19
|
|
20
|
+
var supportedProtocols = [ 'http:', 'https:', 'file:' ];
|
21
|
+
|
20
22
|
/**
|
21
23
|
*
|
22
24
|
* @param {http.ClientRequestArgs} options
|
@@ -129,9 +131,9 @@ module.exports = function httpAdapter(config) {
|
|
129
131
|
// Parse url
|
130
132
|
var fullPath = buildFullPath(config.baseURL, config.url);
|
131
133
|
var parsed = url.parse(fullPath);
|
132
|
-
var protocol =
|
134
|
+
var protocol = parsed.protocol || supportedProtocols[0];
|
133
135
|
|
134
|
-
if (
|
136
|
+
if (supportedProtocols.indexOf(protocol) === -1) {
|
135
137
|
return reject(new AxiosError(
|
136
138
|
'Unsupported protocol ' + protocol,
|
137
139
|
AxiosError.ERR_BAD_REQUEST,
|
package/lib/adapters/xhr.js
CHANGED
@@ -7,7 +7,6 @@ var buildURL = require('./../helpers/buildURL');
|
|
7
7
|
var buildFullPath = require('../core/buildFullPath');
|
8
8
|
var parseHeaders = require('./../helpers/parseHeaders');
|
9
9
|
var isURLSameOrigin = require('./../helpers/isURLSameOrigin');
|
10
|
-
var url = require('url');
|
11
10
|
var transitionalDefaults = require('../defaults/transitional');
|
12
11
|
var AxiosError = require('../core/AxiosError');
|
13
12
|
var CanceledError = require('../cancel/CanceledError');
|
@@ -38,8 +37,6 @@ module.exports = function xhrAdapter(config) {
|
|
38
37
|
}
|
39
38
|
|
40
39
|
var fullPath = buildFullPath(config.baseURL, config.url);
|
41
|
-
var parsed = url.parse(fullPath);
|
42
|
-
var protocol = utils.getProtocol(parsed.protocol);
|
43
40
|
|
44
41
|
request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
|
45
42
|
|
@@ -206,16 +203,15 @@ module.exports = function xhrAdapter(config) {
|
|
206
203
|
requestData = null;
|
207
204
|
}
|
208
205
|
|
209
|
-
|
210
|
-
|
211
|
-
return;
|
212
|
-
}
|
206
|
+
var tokens = fullPath.split(':', 2);
|
207
|
+
var protocol = tokens.length > 1 && tokens[0];
|
213
208
|
|
214
|
-
if (
|
215
|
-
reject(new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_BAD_REQUEST, config));
|
209
|
+
if (protocol && [ 'http', 'https', 'file' ].indexOf(protocol) === -1) {
|
210
|
+
reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
|
216
211
|
return;
|
217
212
|
}
|
218
213
|
|
214
|
+
|
219
215
|
// Send the request
|
220
216
|
request.send(requestData);
|
221
217
|
});
|
package/lib/env/data.js
CHANGED
package/lib/utils.js
CHANGED
@@ -22,22 +22,6 @@ function kindOfTest(type) {
|
|
22
22
|
};
|
23
23
|
}
|
24
24
|
|
25
|
-
/**
|
26
|
-
* Array with axios supported protocols.
|
27
|
-
*/
|
28
|
-
var supportedProtocols = [ 'http:', 'https:', 'file:' ];
|
29
|
-
|
30
|
-
/**
|
31
|
-
* Returns URL protocol passed as param if is not undefined or null,
|
32
|
-
* otherwise just returns 'http:'
|
33
|
-
*
|
34
|
-
* @param {String} protocol The String value of URL protocol
|
35
|
-
* @returns {String} Protocol if the value is not undefined or null
|
36
|
-
*/
|
37
|
-
function getProtocol(protocol) {
|
38
|
-
return protocol || 'http:';
|
39
|
-
}
|
40
|
-
|
41
25
|
/**
|
42
26
|
* Determine if a value is an Array
|
43
27
|
*
|
@@ -453,8 +437,6 @@ var isTypedArray = (function(TypedArray) {
|
|
453
437
|
})(typeof Uint8Array !== 'undefined' && Object.getPrototypeOf(Uint8Array));
|
454
438
|
|
455
439
|
module.exports = {
|
456
|
-
supportedProtocols: supportedProtocols,
|
457
|
-
getProtocol: getProtocol,
|
458
440
|
isArray: isArray,
|
459
441
|
isArrayBuffer: isArrayBuffer,
|
460
442
|
isBuffer: isBuffer,
|