summaryrefslogtreecommitdiff
path: root/tests/unit/serve_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/serve_test.ts')
-rw-r--r--tests/unit/serve_test.ts16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/unit/serve_test.ts b/tests/unit/serve_test.ts
index fde6c7bee..19a8ccad1 100644
--- a/tests/unit/serve_test.ts
+++ b/tests/unit/serve_test.ts
@@ -4191,3 +4191,19 @@ Deno.test({
'Operation `"op_net_listen_unix"` not supported on non-unix platforms.',
);
});
+
+Deno.test({
+ name: "onListen callback gets 0.0.0.0 hostname as is",
+}, async () => {
+ const { promise, resolve } = Promise.withResolvers<{ hostname: string }>();
+
+ const server = Deno.serve({
+ handler: (_) => new Response("ok"),
+ hostname: "0.0.0.0",
+ port: 0,
+ onListen: resolve,
+ });
+ const { hostname } = await promise;
+ assertEquals(hostname, "0.0.0.0");
+ await server.shutdown();
+});