@@ -1055,6 +1055,16 @@ it.each([
10551055 let proxied = 0 ;
10561056 let inspected = 0 ;
10571057 const proxyAuthorizations : Array < string | undefined > = [ ] ;
1058+ // Node passes only one case variant of each environment key on Windows.
1059+ // Clear inherited variants so the lowercase case does not lose to an empty uppercase value.
1060+ const proxyEnvironment = Object . fromEntries (
1061+ Object . entries ( process . env ) . filter (
1062+ ( [ key ] ) =>
1063+ ! [ 'HTTP_PROXY' , 'HTTPS_PROXY' , 'NO_PROXY' , 'NODE_USE_ENV_PROXY' ] . includes (
1064+ key . toUpperCase ( ) ,
1065+ ) ,
1066+ ) ,
1067+ ) ;
10581068 const api = createServer ( ( request , response ) => {
10591069 inspected ++ ;
10601070 expect ( request . headers . authorization ) . toBe ( 'Bearer synthetic-token' ) ;
@@ -1143,16 +1153,12 @@ syncBuiltinESMExports();
11431153 encoding : 'utf8' ,
11441154 timeout : 10_000 ,
11451155 env : {
1146- ...process . env ,
1156+ ...proxyEnvironment ,
11471157 CLOUDFLARE_ACCOUNT_ID : 'test-account' ,
11481158 CLOUDFLARE_API_TOKEN : 'synthetic-token' ,
11491159 CLOUDFLARE_API_BASE_URL : `http://127.0.0.1:${ ( api . address ( ) as AddressInfo ) . port } /client/v4` ,
1150- HTTP_PROXY : lowercase ? '' : proxyUrl ,
1151- http_proxy : lowercase ? proxyUrl : '' ,
1152- HTTPS_PROXY : '' ,
1153- https_proxy : '' ,
1154- NO_PROXY : ! lowercase && bypass ? '127.0.0.1' : '' ,
1155- no_proxy : lowercase && bypass ? '127.0.0.1' : '' ,
1160+ [ lowercase ? 'http_proxy' : 'HTTP_PROXY' ] : proxyUrl ,
1161+ [ lowercase ? 'no_proxy' : 'NO_PROXY' ] : bypass ? '127.0.0.1' : '' ,
11561162 NODE_USE_ENV_PROXY : '' ,
11571163 } ,
11581164 } ,
0 commit comments