diff options
author | Yoshiya Hinosawa <stibium121@gmail.com> | 2023-07-25 15:26:18 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-25 06:26:18 +0000 |
commit | 3d3590063954dd30c1ebea02aad136878eeee04e (patch) | |
tree | 6bc5fd53d4aa4c0d1d88a715f5e2a019fc9bd64f /cli/tests/unit/net_test.ts | |
parent | e311e46a8f80491bc0ab4bc5dfce55d78bdb7187 (diff) |
fix(ext/net): fix string port number handling in listen (#19921)
While string `port` is not allowed in typing, it seems we used to
support that and now it's broken. ref:
https://github.com/denoland/deno/issues/10064#issuecomment-1637427260
This PR restores the support of string port number in `listen` and
`listenTls`
Diffstat (limited to 'cli/tests/unit/net_test.ts')
-rw-r--r-- | cli/tests/unit/net_test.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/cli/tests/unit/net_test.ts b/cli/tests/unit/net_test.ts index 32250bbd0..ca4c5191c 100644 --- a/cli/tests/unit/net_test.ts +++ b/cli/tests/unit/net_test.ts @@ -1237,3 +1237,12 @@ Deno.test({ }, Deno.errors.AddrInUse); listener1.close(); }); + +Deno.test({ + permissions: { net: true }, +}, function netTcpListenDoesNotThrowOnStringPort() { + // @ts-ignore String port is not allowed by typing, but it shouldn't throw + // for backwards compatibility. + const listener = Deno.listen({ hostname: "localhost", port: "0" }); + listener.close(); +}); |