fix: treat non-positive connection limits as unlimited

Signed-off-by: hgshreyas <hgshreyas.cs24@bmsce.ac.in>
This commit is contained in:
hgshreyas committed 2026-08-10 16:14:07 +05:30
1 parent 9e5e5cffe9
commit 8c781c1258
7 files changed
+24 -13

No files matched your search

+8
View File
@@ -131,6 +131,14 @@ describe('request hardening', () => {
server.close();
});
it.each([0, -1])('treats maxConnections=%i as unlimited', (maxConnections) => {
const server = createHttpServer([], [], undefined, undefined, {
limits: { maxConnections },
});
expect(server.maxConnections).toBeUndefined();
server.close();
});
it('requestTimeout does NOT kill an in-flight SSE stream (streaming regression)', async () => {
async function* feed() { for (let n = 1; n <= 3; n++) { yield { n }; await new Promise((r) => setTimeout(r, 80)); } }
const server = createHttpServer(