-
-
Notifications
You must be signed in to change notification settings - Fork 754
Open
Labels
Description
Please avoid duplicates
- I checked all open feature requests and none of them matched my request.
Context
Node now supports HTTP_PROXY/HTTPS_PROXY/NO_PROXY natively via NODE_USE_ENV_PROXY=1 and --use-env-proxy PR nodejs/node#58980
There's three modes I can immediately think of that might be needed globally or per test.
- Use ENV config based on Node options
- Support any ENV config, ensure nock works with any test proxy config
- Ignore any proxy ENV settings and respond to plain request/response meta
From two perspectives
- App's that use proxies and want to test them.
- Test environments that have proxies but don't want to test them (or want test them all the time).
There's probably some interplay with how much fetch can be configured after the --use-env-proxy argument as to what nock could need to support.
As @arunprakashadithyan showed a proxy can currently be worked around by a nock on the proxy server and ignoring the real http host in the path:
nock('http://149.129.239.170:8002', {allowUnmocked: true}).persist()
.get(resource => resource.includes('/comments'))
Alternatives
No response
If the feature request is accepted, would you be willing to submit a PR?
- yes
Reactions are currently unavailable