From 0e3d15164a3ea3b7712348a14fc7f151aa39efe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Joseph?= Date: Wed, 4 Dec 2019 14:08:58 +0100 Subject: [PATCH] Require https-proxy-agent only when actually needed --- lib/BrowserFetcher.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/BrowserFetcher.js b/lib/BrowserFetcher.js index aace9220591f4..76aac08e3683c 100644 --- a/lib/BrowserFetcher.js +++ b/lib/BrowserFetcher.js @@ -23,8 +23,6 @@ const URL = require('url'); const {helper, assert} = require('./helper'); const removeRecursive = require('rimraf'); // @ts-ignore -const ProxyAgent = require('https-proxy-agent'); -// @ts-ignore const getProxyForUrl = require('proxy-from-env').getProxyForUrl; const DEFAULT_DOWNLOAD_HOST = 'https://storage.googleapis.com'; @@ -285,6 +283,8 @@ function httpRequest(url, method, response) { const parsedProxyURL = URL.parse(proxyURL); parsedProxyURL.secureProxy = parsedProxyURL.protocol === 'https:'; + // @ts-ignore + const ProxyAgent = require('https-proxy-agent'); options.agent = new ProxyAgent(parsedProxyURL); options.rejectUnauthorized = false; }