Skip to content

Commit a66ed68

Browse files
docs(protocol): add test with cancelled request
Related: socketio/bun-engine@8f1ea3d
1 parent 3be6481 commit a66ed68

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

docs/engine.io-protocol/v4-test-suite/test-suite.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,25 @@ describe("Engine.IO protocol", () => {
332332

333333
expect(pollResponse.status).to.eql(400);
334334
});
335+
336+
it("closes the session upon cancelled polling request", async () => {
337+
const sid = await initLongPollingSession();
338+
const controller = new AbortController();
339+
340+
fetch(`${URL}/engine.io/?EIO=4&transport=polling&sid=${sid}`, {
341+
signal: controller.signal,
342+
}).catch(() => {});
343+
344+
await sleep(5);
345+
346+
controller.abort();
347+
348+
const pollResponse = await fetch(
349+
`${URL}/engine.io/?EIO=4&transport=polling&sid=${sid}`,
350+
);
351+
352+
expect(pollResponse.status).to.eql(400);
353+
});
335354
});
336355

337356
describe("WebSocket", () => {

0 commit comments

Comments
 (0)