This repository has been archived by the owner on Jan 12, 2021. It is now read-only.
feat: Add support for custom node http agent #53
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We have a complex enterprise CI infrastructure in which we have to go through a proxy to tunnel requests to external servers.
One way to make http(s) requests go through a proxy in Node.js is to setup a custom http agent and pass it in http.request options.
This PR updates some functions to propagate the options that were set by the client. Ultimately, the
request
call will set theagent
in the http.request options if it is set in client provided options.Please note that this
agent
option is only exposed through programmatic usage of the package (that's our usage of it). It is not surfaced as a new CLI option (would be complex to). That being said, as a follow up of this PR, one could update the CLI to expose a newhttp-proxy
option, for user to pass a proxy url, and internally could make use of tunnel -or other lib-, to create an agent from this url and pass it to theupload
options so that it gets set in the http request.