@@ -2227,6 +2227,8 @@ var CanceledError = __nccwpck_require__(6619);
22272227
22282228var isHttps = / h t t p s : ? / ;
22292229
2230+ var supportedProtocols = [ 'http:' , 'https:' , 'file:' ] ;
2231+
22302232/**
22312233 *
22322234 * @param {http.ClientRequestArgs } options
@@ -2339,9 +2341,9 @@ module.exports = function httpAdapter(config) {
23392341 // Parse url
23402342 var fullPath = buildFullPath ( config . baseURL , config . url ) ;
23412343 var parsed = url . parse ( fullPath ) ;
2342- var protocol = utils . getProtocol ( parsed . protocol ) ;
2344+ var protocol = parsed . protocol || supportedProtocols [ 0 ] ;
23432345
2344- if ( ! utils . supportedProtocols . includes ( protocol ) ) {
2346+ if ( supportedProtocols . indexOf ( protocol ) === - 1 ) {
23452347 return reject ( new AxiosError (
23462348 'Unsupported protocol ' + protocol ,
23472349 AxiosError . ERR_BAD_REQUEST ,
@@ -2647,7 +2649,6 @@ var buildURL = __nccwpck_require__(6569);
26472649var buildFullPath = __nccwpck_require__ ( 7124 ) ;
26482650var parseHeaders = __nccwpck_require__ ( 3159 ) ;
26492651var isURLSameOrigin = __nccwpck_require__ ( 7446 ) ;
2650- var url = __nccwpck_require__ ( 7310 ) ;
26512652var transitionalDefaults = __nccwpck_require__ ( 6511 ) ;
26522653var AxiosError = __nccwpck_require__ ( 9206 ) ;
26532654var CanceledError = __nccwpck_require__ ( 6619 ) ;
@@ -2678,8 +2679,6 @@ module.exports = function xhrAdapter(config) {
26782679 }
26792680
26802681 var fullPath = buildFullPath ( config . baseURL , config . url ) ;
2681- var parsed = url . parse ( fullPath ) ;
2682- var protocol = utils . getProtocol ( parsed . protocol ) ;
26832682
26842683 request . open ( config . method . toUpperCase ( ) , buildURL ( fullPath , config . params , config . paramsSerializer ) , true ) ;
26852684
@@ -2846,16 +2845,15 @@ module.exports = function xhrAdapter(config) {
28462845 requestData = null ;
28472846 }
28482847
2849- if ( parsed . path === null ) {
2850- reject ( new AxiosError ( 'Malformed URL ' + fullPath , AxiosError . ERR_BAD_REQUEST , config ) ) ;
2851- return ;
2852- }
2848+ var tokens = fullPath . split ( ':' , 2 ) ;
2849+ var protocol = tokens . length > 1 && tokens [ 0 ] ;
28532850
2854- if ( ! utils . supportedProtocols . includes ( protocol ) ) {
2855- reject ( new AxiosError ( 'Unsupported protocol ' + protocol , AxiosError . ERR_BAD_REQUEST , config ) ) ;
2851+ if ( protocol && [ 'http' , 'https' , 'file' ] . indexOf ( protocol ) === - 1 ) {
2852+ reject ( new AxiosError ( 'Unsupported protocol ' + protocol + ':' , AxiosError . ERR_BAD_REQUEST , config ) ) ;
28562853 return ;
28572854 }
28582855
2856+
28592857 // Send the request
28602858 request . send ( requestData ) ;
28612859 } ) ;
@@ -3906,7 +3904,7 @@ module.exports = {
39063904/***/ ( ( module ) => {
39073905
39083906module . exports = {
3909- "version" : "0.27.0 "
3907+ "version" : "0.27.1 "
39103908} ;
39113909
39123910/***/ } ) ,
@@ -4528,22 +4526,6 @@ function kindOfTest(type) {
45284526 } ;
45294527}
45304528
4531- /**
4532- * Array with axios supported protocols.
4533- */
4534- var supportedProtocols = [ 'http:' , 'https:' , 'file:' ] ;
4535-
4536- /**
4537- * Returns URL protocol passed as param if is not undefined or null,
4538- * otherwise just returns 'http:'
4539- *
4540- * @param {String } protocol The String value of URL protocol
4541- * @returns {String } Protocol if the value is not undefined or null
4542- */
4543- function getProtocol ( protocol ) {
4544- return protocol || 'http:' ;
4545- }
4546-
45474529/**
45484530 * Determine if a value is an Array
45494531 *
@@ -4959,8 +4941,6 @@ var isTypedArray = (function(TypedArray) {
49594941} ) ( typeof Uint8Array !== 'undefined' && Object . getPrototypeOf ( Uint8Array ) ) ;
49604942
49614943module . exports = {
4962- supportedProtocols : supportedProtocols ,
4963- getProtocol : getProtocol ,
49644944 isArray : isArray ,
49654945 isArrayBuffer : isArrayBuffer ,
49664946 isBuffer : isBuffer ,
0 commit comments