With proxy-agent@5.0.0, the following code worked (example taken from here):
// index.mjs
import * as http from 'http'
import ProxyAgent from 'proxy-agent'
// The correct proxy `Agent` implementation to use will be determined
// via the `http_proxy` / `https_proxy` / `no_proxy` / etc. env vars
const agent = new ProxyAgent()
// The rest works just like any other normal HTTP request
http.get('http://jsonip.com', {agent}, (res) => {
console.log(res.statusCode, res.headers)
res.pipe(process.stdout)
})
With
proxy-agent@5.0.0
, the following code worked (example taken from here):Test command line (this uses a PAC file which only returns
"DIRECT"
):After upgrading to
proxy-agent@6.2.1
(and doing this little change:)Then it fails with this:
I think that's because
isValidProtocol()
https://github.com/TooTallNate/proxy-agents/blob/08487f0a7a72d3986b62d85eba8e777a1ff274c7/packages/proxy-agent/src/index.ts#L133-L135uses those protocols: https://github.com/TooTallNate/proxy-agents/blob/08487f0a7a72d3986b62d85eba8e777a1ff274c7/packages/pac-proxy-agent/src/index.ts#L58-L64