Move tunnel logic into separate module #1631
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.
Following the current convention for the rest of the internal modules in request I moved out the tunnel logic. The first two commits are strictly non breaking changes. In the third one I removed 3 properties out of the request instance.
I'm overriding the
proxyHeaderWhiteList
andproxyHeaderExclusiveList
via theoptions
argument insetup
. In future I would like to not rely on extending the instance in the request ctor, so this approach will help me on the next step of the refactoring. In future I would like to have a strict mechanism with corresponding tests to explicitly define all of the expected public properties for the request instance. This will give us the flexibility to make internal changes more easily, as right now it's not clear if a property is set on the request instance with the intention to be public, or just to carry state through out the instance. And of course someone down the line might actually rely on it.Also what I noticed is that
options.proxyHeaderExclusiveList
extendsdefaultProxyHeaderExclusiveList
, butoptions.proxyHeaderWhiteList
overridesdefaultProxyHeaderWhiteList
. Changingoptions.proxyHeaderWhiteList
to extenddefaultProxyHeaderWhiteList
doesn't break anything, therefore we don't have tests for that behavior, so I left it as it is.//cc @mikeal @nylen