From fe1b512820cbdfd2b93ddfc8e935556878339425 Mon Sep 17 00:00:00 2001 From: DjDeveloper <43033058+DjDeveloperr@users.noreply.github.com> Date: Sun, 21 Feb 2021 22:21:46 +0530 Subject: fix(op_crates/websocket): default to close code 1005 (#9339) Currently if WebSocket is closed without code, it will error while on Chrome it would close with code 1005 instead. Co-authored-by: crowlKats <13135287+crowlKats@users.noreply.github.com> --- cli/tests/websocket_test.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'cli/tests/websocket_test.ts') diff --git a/cli/tests/websocket_test.ts b/cli/tests/websocket_test.ts index b5f865943..8a7fc812c 100644 --- a/cli/tests/websocket_test.ts +++ b/cli/tests/websocket_test.ts @@ -295,3 +295,14 @@ Deno.test("Event Handlers order", async () => { }; await promise; }); + +Deno.test("Close without frame", async () => { + const promise = deferred(); + const ws = new WebSocket("ws://localhost:4244"); + ws.onerror = (): void => fail(); + ws.onclose = (e): void => { + assertEquals(e.code, 1005); + promise.resolve(); + }; + await promise; +}); -- cgit v1.2.3