0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-03 09:31:22 -05:00

fix: add NO_PROXY to deno help and add test (#7048)

This commit is contained in:
Tomofumi Chiba 2020-08-15 22:48:29 +09:00 committed by GitHub
parent 42ff8ede4c
commit b684df784e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 0 deletions

View file

@ -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

View file

@ -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);