diff options
Diffstat (limited to 'tests/unit_node')
-rw-r--r-- | tests/unit_node/http_test.ts | 8 | ||||
-rw-r--r-- | tests/unit_node/tls_test.ts | 12 |
2 files changed, 15 insertions, 5 deletions
diff --git a/tests/unit_node/http_test.ts b/tests/unit_node/http_test.ts index f85b1466b..f1ff77bb3 100644 --- a/tests/unit_node/http_test.ts +++ b/tests/unit_node/http_test.ts @@ -318,10 +318,14 @@ Deno.test("[node/http] IncomingRequest socket has remoteAddress + remotePort", a // deno-lint-ignore no-explicit-any const port = (server.address() as any).port; const res = await fetch( - `http://127.0.0.1:${port}/`, + `http://localhost:${port}/`, ); await res.arrayBuffer(); - assertEquals(remoteAddress, "127.0.0.1"); + if (Deno.build.os === "windows") { + assertEquals(remoteAddress, "127.0.0.1"); + } else { + assertEquals(remoteAddress, "::1"); + } assertEquals(typeof remotePort, "number"); server.close(() => resolve()); }); diff --git a/tests/unit_node/tls_test.ts b/tests/unit_node/tls_test.ts index 93eacd5ec..847ec2dde 100644 --- a/tests/unit_node/tls_test.ts +++ b/tests/unit_node/tls_test.ts @@ -32,13 +32,15 @@ for ( ) { Deno.test(`tls.connect sends correct ALPN: '${alpnServer}' + '${alpnClient}' = '${expected}'`, async () => { const listener = Deno.listenTls({ + hostname: "localhost", port: 0, key, cert, alpnProtocols: alpnServer, }); const outgoing = tls.connect({ - host: "localhost", + host: "::1", + servername: "localhost", port: listener.addr.port, ALPNProtocols: alpnClient, secureContext: { @@ -61,6 +63,7 @@ Deno.test("tls.connect makes tls connection", async () => { const ctl = new AbortController(); let port; const serve = Deno.serve({ + hostname: "localhost", port: 0, key, cert, @@ -71,7 +74,8 @@ Deno.test("tls.connect makes tls connection", async () => { await delay(200); const conn = tls.connect({ - host: "localhost", + host: "::1", + servername: "localhost", port, secureContext: { ca: rootCaCert, @@ -102,6 +106,7 @@ Deno.test("tls.connect mid-read tcp->tls upgrade", async () => { const { promise, resolve } = Promise.withResolvers<void>(); const ctl = new AbortController(); const serve = Deno.serve({ + hostname: "localhost", port: 8443, key, cert, @@ -111,7 +116,8 @@ Deno.test("tls.connect mid-read tcp->tls upgrade", async () => { await delay(200); const conn = tls.connect({ - host: "localhost", + host: "::1", + servername: "localhost", port: 8443, secureContext: { ca: rootCaCert, |