aboutsummaryrefslogtreecommitdiff
path: root/test/js/node/http/node-http.test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'test/js/node/http/node-http.test.ts')
-rw-r--r--test/js/node/http/node-http.test.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/js/node/http/node-http.test.ts b/test/js/node/http/node-http.test.ts
index d28676a19..6fa3e1831 100644
--- a/test/js/node/http/node-http.test.ts
+++ b/test/js/node/http/node-http.test.ts
@@ -869,4 +869,22 @@ describe("node:http", () => {
}
});
});
+
+ test("should listen on port if string, issue#4582", () => {
+ const server = createServer((req, res) => {
+ res.end();
+ });
+ server.listen({ port: "0" }, async (_err, host, port) => {
+ try {
+ await fetch(`http://${host}:${port}`).then(res => {
+ expect(res.status).toBe(200);
+ done();
+ });
+ } catch (err) {
+ done(err);
+ } finally {
+ server.close();
+ }
+ });
+ });
});