diff options
author | Tomofumi Chiba <tomofumi.chiba@gmail.com> | 2020-08-15 22:48:29 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-15 09:48:29 -0400 |
commit | b684df784ef0ecbdf8bc3b6015177b6829420f86 (patch) | |
tree | 43fa416b91afb44c1c1a1d54e3ea2cf085b09c22 | |
parent | 42ff8ede4c756b72d557b3f31384eb8b97392d5d (diff) |
fix: add `NO_PROXY` to `deno help` and add test (#7048)
-rw-r--r-- | cli/flags.rs | 2 | ||||
-rw-r--r-- | cli/tests/045_proxy_test.ts | 45 |
2 files changed, 47 insertions, 0 deletions
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<void> { http.close(); } +async function testFetchNoProxy(): Promise<void> { + 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<void> { + 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); |