diff --git a/cli/flags.rs b/cli/flags.rs index b6e7abefb8..f6cebae469 100644 --- a/cli/flags.rs +++ b/cli/flags.rs @@ -196,6 +196,8 @@ static ENV_VARIABLES_HELP: &str = "ENVIRONMENT VARIABLES: HTTP_PROXY Proxy address for HTTP requests (module downloads, fetch) HTTPS_PROXY Proxy address for HTTPS requests + (module downloads, fetch) + NO_PROXY Comma-separated list of hosts which do not use a proxy (module downloads, fetch)"; static DENO_HELP: &str = "A secure JavaScript and TypeScript runtime diff --git a/cli/tests/045_proxy_test.ts b/cli/tests/045_proxy_test.ts index c8df8ceb2e..873d3a0c17 100644 --- a/cli/tests/045_proxy_test.ts +++ b/cli/tests/045_proxy_test.ts @@ -67,7 +67,52 @@ async function testModuleDownload(): Promise { http.close(); } +async function testFetchNoProxy(): Promise { + const c = Deno.run({ + cmd: [ + Deno.execPath(), + "run", + "--quiet", + "--reload", + "--allow-net", + "045_proxy_client.ts", + ], + stdout: "piped", + env: { + HTTP_PROXY: "http://not.exising.proxy.server", + NO_PROXY: "localhost", + }, + }); + + const status = await c.status(); + assertEquals(status.code, 0); + c.close(); +} + +async function testModuleDownloadNoProxy(): Promise { + const http = Deno.run({ + cmd: [ + Deno.execPath(), + "cache", + "--reload", + "--quiet", + "http://localhost:4545/std/examples/colors.ts", + ], + stdout: "piped", + env: { + HTTP_PROXY: "http://not.exising.proxy.server", + NO_PROXY: "localhost", + }, + }); + + const httpStatus = await http.status(); + assertEquals(httpStatus.code, 0); + http.close(); +} + proxyServer(); await testFetch(); await testModuleDownload(); +await testFetchNoProxy(); +await testModuleDownloadNoProxy(); Deno.exit(0);