diff options
Diffstat (limited to 'cli/tests/045_proxy_test.ts')
-rw-r--r-- | cli/tests/045_proxy_test.ts | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/cli/tests/045_proxy_test.ts b/cli/tests/045_proxy_test.ts index c7ba5e967..6e338f4fc 100644 --- a/cli/tests/045_proxy_test.ts +++ b/cli/tests/045_proxy_test.ts @@ -15,6 +15,11 @@ async function proxyServer(): Promise<void> { async function proxyRequest(req: ServerRequest): Promise<void> { console.log(`Proxy request to: ${req.url}`); + const proxyAuthorization = req.headers.get("proxy-authorization"); + if (proxyAuthorization) { + console.log(`proxy-authorization: ${proxyAuthorization}`); + req.headers.delete("proxy-authorization"); + } const resp = await fetch(req.url, { method: req.method, headers: req.headers, @@ -110,9 +115,28 @@ async function testModuleDownloadNoProxy(): Promise<void> { http.close(); } +async function testFetchProgrammaticProxy(): Promise<void> { + const c = Deno.run({ + cmd: [ + Deno.execPath(), + "run", + "--quiet", + "--reload", + "--allow-net=localhost:4545,localhost:4555", + "--unstable", + "045_programmatic_proxy_client.ts", + ], + stdout: "piped", + }); + const status = await c.status(); + assertEquals(status.code, 0); + c.close(); +} + proxyServer(); await testFetch(); await testModuleDownload(); await testFetchNoProxy(); await testModuleDownloadNoProxy(); +await testFetchProgrammaticProxy(); Deno.exit(0); |