From 3d3590063954dd30c1ebea02aad136878eeee04e Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Tue, 25 Jul 2023 15:26:18 +0900 Subject: 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` --- ext/net/01_net.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ext/net/01_net.js') diff --git a/ext/net/01_net.js b/ext/net/01_net.js index e8ce3a300..9cdcdb78c 100644 --- a/ext/net/01_net.js +++ b/ext/net/01_net.js @@ -15,6 +15,7 @@ const { ArrayPrototypeForEach, ArrayPrototypePush, Error, + Number, ObjectPrototypeIsPrototypeOf, PromiseResolve, SymbolAsyncIterator, @@ -420,7 +421,7 @@ function listen(args) { case "tcp": { const { 0: rid, 1: addr } = ops.op_net_listen_tcp({ hostname: args.hostname ?? "0.0.0.0", - port: args.port, + port: Number(args.port), }, args.reusePort); addr.transport = "tcp"; return new Listener(rid, addr); -- cgit v1.2.3