File tree Expand file tree Collapse file tree 1 file changed +25
-4
lines changed
Expand file tree Collapse file tree 1 file changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -14,10 +14,31 @@ export default async function fetch(url, config) {
1414 headers : { 'Accept-Language' : config . language } ,
1515 } ;
1616
17- if ( url . startsWith ( 'https:' ) && process . env . HTTPS_PROXY ) {
18- nodeFetchOptions . agent = new HttpsProxyAgent ( process . env . HTTPS_PROXY ) ;
19- } else if ( url . startsWith ( 'http:' ) && process . env . HTTP_PROXY ) {
20- nodeFetchOptions . agent = new HttpProxyAgent ( process . env . HTTP_PROXY ) ;
17+ // Handle http_proxy/https_proxy environment variables precedence
18+ let http_proxy = null ;
19+ let https_proxy = null ;
20+
21+ if ( process . env . http_proxy ) {
22+ http_proxy = process . env . http_proxy ;
23+ }
24+ else if ( process . env . HTTP_PROXY ) {
25+ http_proxy = process . env . HTTP_PROXY ;
26+ }
27+
28+ if ( process . env . https_proxy ) {
29+ https_proxy = process . env . https_proxy ;
30+ }
31+ else if ( process . env . HTTPS_PROXY ) {
32+ https_proxy = process . env . HTTPS_PROXY ;
33+ }
34+ else if ( http_proxy ) {
35+ https_proxy = http_proxy ;
36+ }
37+
38+ if ( url . startsWith ( 'https:' ) && https_proxy ) {
39+ nodeFetchOptions . agent = new HttpsProxyAgent ( https_proxy ) ;
40+ } else if ( url . startsWith ( 'http:' ) && http_proxy ) {
41+ nodeFetchOptions . agent = new HttpProxyAgent ( http_proxy ) ;
2142 }
2243
2344 let response ;
You can’t perform that action at this time.
0 commit comments