(env: Env = process.env)
| 334 | * so an `ALL_PROXY`-only parent still proxies the child. |
| 335 | */ |
| 336 | export function proxyEnvForChild(env: Env = process.env): Record<string, string> { |
| 337 | if (!hasHttpProxy(env)) return {}; |
| 338 | const noProxy = resolveNoProxy(env); |
| 339 | const result: Record<string, string> = { |
| 340 | NODE_USE_ENV_PROXY: '1', |
| 341 | NO_PROXY: noProxy, |
| 342 | no_proxy: noProxy, |
| 343 | }; |
| 344 | const { httpProxy, httpsProxy } = resolveHttpProxyUrls(env); |
| 345 | if (httpProxy !== undefined) { |
| 346 | result['HTTP_PROXY'] = httpProxy; |
| 347 | result['http_proxy'] = httpProxy; |
| 348 | } |
| 349 | if (httpsProxy !== undefined) { |
| 350 | result['HTTPS_PROXY'] = httpsProxy; |
| 351 | result['https_proxy'] = httpsProxy; |
| 352 | } |
| 353 | return result; |
| 354 | } |
| 355 | |
| 356 | /** |
| 357 | * Mirror a server config's `NO_PROXY` override onto both casings of the child |
no test coverage detected