aboutsummaryrefslogtreecommitdiff
path: root/test/js/node
diff options
context:
space:
mode:
authorGravatar Ashcon Partovi <ashcon@partovi.net> 2023-09-08 16:27:44 -0700
committerGravatar GitHub <noreply@github.com> 2023-09-08 16:27:44 -0700
commitffe4f561a3af53b9f5a41c182de55d7199b5d692 (patch)
tree5ecf85239c16ab22e790b1c85bcdf0961c01f9a9 /test/js/node
parentc896792c37574b745f5b2a05e2f7d20aa4cdd9ac (diff)
downloadbun-ffe4f561a3af53b9f5a41c182de55d7199b5d692.tar.gz
bun-ffe4f561a3af53b9f5a41c182de55d7199b5d692.tar.zst
bun-ffe4f561a3af53b9f5a41c182de55d7199b5d692.zip
Fix listen() using unix socket if argument is a valid port (#4620)
* Fix listen() using unix socket if argument is a valid port Fixes #4582 * Add test
Diffstat (limited to 'test/js/node')
-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();
+ }
+ });
+ });
});