mirror of
https://github.com/tenrok/axios.git
synced 2026-06-11 18:02:32 +03:00
Returned error treated when requesting uncommon URL (#3544)
* Fixing error returned when requesting illegal URL * Adding unit tests http.js * Fixing error message axios invalid request from browser * Adding unit tests requests.spec.js * Adding at utils.js a new method: getProtocol Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
committed by
GitHub
parent
412d3bd607
commit
195c8e5ff5
@@ -6,6 +6,22 @@ var bind = require('./helpers/bind');
|
||||
|
||||
var toString = Object.prototype.toString;
|
||||
|
||||
/**
|
||||
* Array with axios supported protocols.
|
||||
*/
|
||||
var supportedProtocols = [ 'http:', 'https:', 'file:' ];
|
||||
|
||||
/**
|
||||
* Returns URL protocol passed as param if is not undefined or null,
|
||||
* otherwise just returns 'http:'
|
||||
*
|
||||
* @param {String} protocol The String value of URL protocol
|
||||
* @returns {String} Protocol if the value is not undefined or null
|
||||
*/
|
||||
function getProtocol(protocol) {
|
||||
return protocol || 'http:';
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a value is an Array
|
||||
*
|
||||
@@ -324,6 +340,8 @@ function stripBOM(content) {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
supportedProtocols: supportedProtocols,
|
||||
getProtocol: getProtocol,
|
||||
isArray: isArray,
|
||||
isArrayBuffer: isArrayBuffer,
|
||||
isBuffer: isBuffer,
|
||||
|
||||
Reference in New Issue
Block a user