@@ -39,14 +39,26 @@ export default class WebChannel extends Channel {
3939 // eslint-disable-next-line @typescript-eslint/no-misused-promises
4040 return async ( method , requestData , callback ) => {
4141 try {
42- const shouldUseHttps = ! (
43- this . _address . includes ( "localhost" ) ||
44- this . _address . includes ( "127.0.0.1" )
45- ) ;
42+ // Check if address already contains a scheme
43+ const hasScheme =
44+ this . _address . startsWith ( "http://" ) ||
45+ this . _address . startsWith ( "https://" ) ;
46+
47+ let address ;
48+ if ( hasScheme ) {
49+ // Use the address as-is if it already has a scheme
50+ address = this . _address ;
51+ } else {
52+ // Only prepend scheme if none exists
53+ const shouldUseHttps = ! (
54+ this . _address . includes ( "localhost" ) ||
55+ this . _address . includes ( "127.0.0.1" )
56+ ) ;
4657
47- const address = shouldUseHttps
48- ? `https://${ this . _address } `
49- : `http://${ this . _address } ` ;
58+ address = shouldUseHttps
59+ ? `https://${ this . _address } `
60+ : `http://${ this . _address } ` ;
61+ }
5062 // this will be executed in a browser environment so eslint is
5163 // disabled for the fetch call
5264 //eslint-disable-next-line n/no-unsupported-features/node-builtins
0 commit comments