From b684df784ef0ecbdf8bc3b6015177b6829420f86 Mon Sep 17 00:00:00 2001 From: Tomofumi Chiba Date: Sat, 15 Aug 2020 22:48:29 +0900 Subject: fix: add `NO_PROXY` to `deno help` and add test (#7048) --- cli/flags.rs | 2 ++ cli/tests/045_proxy_test.ts | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) (limited to 'cli') diff --git a/cli/flags.rs b/cli/flags.rs index b6e7abefb..f6cebae46 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 c8df8ceb2..873d3a0c1 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); -- cgit v1.2.3