interceptors icon indicating copy to clipboard operation
interceptors copied to clipboard

Protocol "https:" not supported. Expected "http:"

Open WhoisUnknown opened this issue 2 years ago • 0 comments

Hello. Thanks for you work.

I migrate from version 0.12.7 to 0.23.0 and get an error when I use http proxy

node:_http_client:189
    throw new ERR_INVALID_PROTOCOL(protocol, expectedProtocol);
    ^

TypeError [ERR_INVALID_PROTOCOL]: Protocol "https:" not supported. Expected "http:"
    at new NodeError (node:internal\errors:399:5)
    at new ClientRequest (node:_http_client:189:11)
    at new _NodeClientRequest (folder\node_modules\@mswjs\interceptors\lib\node\chunk-4YIZAGXJ.js:146:5)
    at Object.<anonymous> (folder\node_modules\@mswjs\interceptors\lib\node\chunk-4YIZAGXJ.js:665:22)
    at Object.<anonymous> (folder\dist\scripts\test.js:58:7)
    at Module._compile (node:internal\modules\cjs\loader:1256:14)
    at Module._extensions..js (node:internal\modules\cjs\loader:1310:10)
    at Module.load (node:internal\modules\cjs\loader:1119:32)
    at Module._load (node:internal\modules\cjs\loader:960:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal\modules\run_main:81:12) {
  code: 'ERR_INVALID_PROTOCOL'
}

Node.js v18.16.1

I am using https-user-agent and http proxy to it.

Version 0.12.7 this worked with proxy correctly

I made demo repository https://github.com/WhoisUnknown/example-interseptor

WhoisUnknown avatar Jul 12 '23 13:07 WhoisUnknown