From 0d0c76aa6f9b875fe463af84f16cb7812b899cde Mon Sep 17 00:00:00 2001 From: Jakub Mikulas Date: Tue, 30 Mar 2021 22:51:38 +0200 Subject: [PATCH] feat: support lowercase http_proxy envvars --- src/lib/request/request.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/lib/request/request.ts b/src/lib/request/request.ts index 42ca5162a7..2580347753 100644 --- a/src/lib/request/request.ts +++ b/src/lib/request/request.ts @@ -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) => {