diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2022-08-21 21:15:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-21 21:15:52 +0200 |
commit | 301f6c46ba4491e9aec76037ae9d01365693b0e4 (patch) | |
tree | 94bc33b4fac9adc483a123dfb874be19d5842fbf /cli/tests | |
parent | 5ea51702bd4a3f7b14cd754b3218e50f9ed07bcc (diff) |
fix(unstable): better error for invalid hostname in Deno.serve() (#15529)
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/unit/flash_test.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/cli/tests/unit/flash_test.ts b/cli/tests/unit/flash_test.ts index 4df225cbd..fdad1e3ae 100644 --- a/cli/tests/unit/flash_test.ts +++ b/cli/tests/unit/flash_test.ts @@ -36,6 +36,18 @@ function onListen<T>( }; } +Deno.test(async function httpServerInvalidHostname() { + assertThrows( + () => + Deno.serve({ + fetch: (_req) => new Response("ok"), + hostname: "localhost", + }), + TypeError, + "hostname could not be parsed as an IP address", + ); +}); + Deno.test({ permissions: { net: true } }, async function httpServerBasic() { const ac = new AbortController(); const promise = deferred(); |