diff options
author | 2023-08-25 08:16:51 +0800 | |
---|---|---|
committer | 2023-08-24 17:16:51 -0700 | |
commit | 339d2c7f190c81bbf2c64f3fd5715b3ebe8841ab (patch) | |
tree | a29fd63e0d0411ac5cf0f2822b28e5307b327a31 /test/js/node/http/node-http.test.ts | |
parent | d2bef4fbeae798cde08745b211d150417428b270 (diff) | |
download | bun-339d2c7f190c81bbf2c64f3fd5715b3ebe8841ab.tar.gz bun-339d2c7f190c81bbf2c64f3fd5715b3ebe8841ab.tar.zst bun-339d2c7f190c81bbf2c64f3fd5715b3ebe8841ab.zip |
Make the server not crash if an error occurs in dev build. (#4300)
Close: #4298
Diffstat (limited to 'test/js/node/http/node-http.test.ts')
-rw-r--r-- | test/js/node/http/node-http.test.ts | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/js/node/http/node-http.test.ts b/test/js/node/http/node-http.test.ts index 6dca23547..3a654c393 100644 --- a/test/js/node/http/node-http.test.ts +++ b/test/js/node/http/node-http.test.ts @@ -750,4 +750,20 @@ describe("node:http", () => { } }); }); + + test("test server internal error, issue#4298", done => { + const server = createServer((req, res) => { + throw Error("throw an error here."); + }); + server.listen({ port: 0 }, async (_err, host, port) => { + try { + await fetch(`http://${host}:${port}`).then(res => { + expect(res.status).toBe(500); + done(); + }); + } catch (err) { + done(err); + } + }); + }); }); |