summaryrefslogtreecommitdiff
path: root/tests/unit/serve_test.ts
diff options
context:
space:
mode:
authorMatt Mastracci <matthew@mastracci.com>2024-04-24 14:27:15 -0400
committerGitHub <noreply@github.com>2024-04-24 14:27:15 -0400
commitda70608700274392a8f134735ac3701eecd6cfa7 (patch)
treeb977ecacc2d6cf64110d0d53ba7063a48753f781 /tests/unit/serve_test.ts
parenteed2598e6cf1db643b4edd07b5eff94c59eb9408 (diff)
fix(ext/net): check for TLS using undefined rather than using ReflectHas (#23538)
Fixes #23537
Diffstat (limited to 'tests/unit/serve_test.ts')
-rw-r--r--tests/unit/serve_test.ts31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/unit/serve_test.ts b/tests/unit/serve_test.ts
index 32d05056a..8978c4f7e 100644
--- a/tests/unit/serve_test.ts
+++ b/tests/unit/serve_test.ts
@@ -2889,6 +2889,37 @@ Deno.test(
},
);
+// Regression test for https://github.com/denoland/deno/issues/23537
+Deno.test(
+ { permissions: { read: true, net: true } },
+ async function httpServerUndefinedCert() {
+ const ac = new AbortController();
+ const { promise, resolve } = Promise.withResolvers<void>();
+ const hostname = "127.0.0.1";
+
+ const server = Deno.serve({
+ handler: () => new Response("Hello World"),
+ hostname,
+ port: servePort,
+ signal: ac.signal,
+ onListen: onListen(resolve),
+ onError: createOnErrorCb(ac),
+ // Undefined should be equivalent to missing
+ cert: undefined,
+ key: undefined,
+ });
+
+ await promise;
+ const resp = await fetch(`http://localhost:${servePort}/`);
+
+ const respBody = await resp.text();
+ assertEquals("Hello World", respBody);
+
+ ac.abort();
+ await server.finished;
+ },
+);
+
Deno.test(
{ permissions: { read: true, net: true } },
async function httpServerWithTls() {