Skip to content

Commit

Permalink
feat: support lowercase http_proxy envvars
Browse files Browse the repository at this point in the history
  • Loading branch information
JackuB committed Mar 30, 2021
1 parent e597846 commit 0d0c76a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lib/request/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ declare const global: Global;
export = function makeRequest(
payload: Payload,
): Promise<{ res: needle.NeedleResponse; body: any }> {
// This ensures we support lowercase http(s)_proxy values as well
// 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
if (process.env.HTTP_PROXY || process.env.http_proxy) {
process.env.HTTP_PROXY = process.env.HTTP_PROXY || process.env.http_proxy;
}
if (process.env.HTTPS_PROXY || process.env.https_proxy) {
process.env.HTTPS_PROXY =
process.env.HTTPS_PROXY || process.env.https_proxy;
}

return getVersion().then(
(versionNumber) =>
new Promise((resolve, reject) => {
Expand Down

0 comments on commit 0d0c76a

Please sign in to comment.