http: use env proxy when agent has no proxyEnv option#64528
Conversation
|
Review requested:
|
mcollina
left a comment
There was a problem hiding this comment.
Thanks for opening a PR! Can you please add a unit test?
5166481 to
19d1924
Compare
now I refreshed the PR and a unit test included. |
|
@joyeecheung I think this is a bugfix, but an argument could be made this is semver-major. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #64528 +/- ##
=======================================
Coverage 90.24% 90.24%
=======================================
Files 739 739
Lines 241669 241701 +32
Branches 45543 45553 +10
=======================================
+ Hits 218087 218130 +43
+ Misses 15150 15100 -50
- Partials 8432 8471 +39
🚀 New features to boost your workflow:
|
19d1924 to
fc4352d
Compare
|
joyeecheung
left a comment
There was a problem hiding this comment.
Can you update the documentation to clarify the behavior?
When a user creates a custom agent without specifying proxyEnv but
Node.js is configured to use a proxy from the environment (via
--use-env-proxy or NODE_USE_ENV_PROXY), fall back to process.env.
A developer can still explicitly disable proxying for an agent even
when Node.js is configured to use a proxy at runtime, by passing a
falsy proxyEnv explicitly. For example:
const agent = new https.Agent({ proxyEnv: null });
Signed-off-by: swigger <swigger@gmail.com>
fc4352d to
1a701f6
Compare
When a user creates a custom agent without specifying proxyEnv but Node.js is configured to use a proxy from the environment (via --use-env-proxy or NODE_USE_ENV_PROXY), fall back to process.env.
A developer can still explicitly disable proxying for an agent even when Node.js is configured to use a proxy at runtime, by passing a falsy proxyEnv explicitly. For example: