TooTallNate / node-proxy-agent

Maps proxy protocols to `http.Agent` implementations
285 stars 69 forks source link

Set the protocol to http(s) by default if none is provided #39

Closed shesek closed 1 year ago

shesek commented 5 years ago

Without this, proxy-from-env gets called with an object that doesn't have a protocol property set, which causes it to exit early and do nothing.

This is what the opts object passed to connect normally looks like:

{ method: 'GET',
  port: 443,
  host: 'foobar.com',
  ca: undefined,
  key: undefined,
  pfx: undefined,
  cert: undefined,
  passphrase: undefined,
  secureEndpoint: true
}
shesek commented 5 years ago

Ping? :)

TooTallNate commented 5 years ago

Code LGTM. Would it be possible to add a test case?

shesek commented 5 years ago

Perhaps I could add a unit test that tries to use superagent-proxy?

This simple example currently fails: let req=require("superagent"); require("superagent-proxy")(req); req.get("https://encrypted.google.com/").proxy().end(console.log). Running it with ALL_PROXY/HTTPS_PROXY ignores the proxy.

TooTallNate commented 1 year ago

This code in this repository has been moved to the proxy-agents monorepo, so I am closing this pull request. If you feel that this change is still necessary as of the latest release, feel free to open a new pull request over there.