Skip to content

Commit 0a3d0af

Browse files
committed
Fix bug with HTTP interception in worker threads on Windows
1 parent 89ba2ec commit 0a3d0af

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

overrides/js/prepend-node.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@
1212

1313
const wrapModule = require('./wrap-require');
1414

15+
// These should always both be set identically by HTTP Toolkit, so this should be a no-op.
16+
// Unfortunately, on Windows env vars are case insensitive, and the logic to handle this
17+
// in worker threads this has a bug in some versions, so this is required. More details in
18+
// https://github.com/httptoolkit/httptoolkit-server/issues/91.
19+
if (process.env.http_proxy && !process.env.HTTP_PROXY) {
20+
process.env.HTTP_PROXY = process.env.http_proxy;
21+
}
22+
1523
wrapModule('axios', function wrapAxios (loadedModule) {
1624
// Global agent handles this automatically, if used (i.e. Node >= 10)
1725
if (global.GLOBAL_AGENT) return;

0 commit comments

Comments
 (0)