Skip to content

Commit 0d0c76a

Browse files
committedMar 30, 2021
feat: support lowercase http_proxy envvars
1 parent e597846 commit 0d0c76a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
 

‎src/lib/request/request.ts

+10
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ declare const global: Global;
2121
export = function makeRequest(
2222
payload: Payload,
2323
): Promise<{ res: needle.NeedleResponse; body: any }> {
24+
// This ensures we support lowercase http(s)_proxy values as well
25+
// The weird IF around it ensures we don't create an envvar with a value of undefined, which throws error when trying to use it as a proxy
26+
if (process.env.HTTP_PROXY || process.env.http_proxy) {
27+
process.env.HTTP_PROXY = process.env.HTTP_PROXY || process.env.http_proxy;
28+
}
29+
if (process.env.HTTPS_PROXY || process.env.https_proxy) {
30+
process.env.HTTPS_PROXY =
31+
process.env.HTTPS_PROXY || process.env.https_proxy;
32+
}
33+
2434
return getVersion().then(
2535
(versionNumber) =>
2636
new Promise((resolve, reject) => {

0 commit comments

Comments
 (0)
Please sign in to comment.