You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the server websocket beforeHandle() returns ws.error(403, 'forbidden') I would expect the client websocket on error to be called with the 403 forbidden error.
What do you see instead?
Instead of the on error callback, the on close callback is called and the websocket status code is 1002 with no trace of the 403 code
$ bun test
bun test v1.1.29 (6d43b366)
src/app.test.ts:
CLOSE: 1002
10 | }
11 | })
12 | .listen(4000);
13 |
14 | describe("Elysia ws error test", () => {
15 | test("Elysia ws error", async () => {
^
error:
Expected promise that resolves
Received promise that rejected: Promise { <rejected> }
at /home/tfk/Documents/elysiaTest/app/src/app.test.ts:15:27
✗ Elysia ws error test > Elysia ws error [4.88ms]
0 pass
1 fail
1 expect() calls
Ran 1 tests across 1 files. [47.00ms]
Additional information
No response
Have you try removing the node_modules and bun.lockb and try again yet?
yes
The text was updated successfully, but these errors were encountered:
beforeHandle method is interuppting the websocket handshake, hence it will close the connection (meaning we should listen to the close event in this case)
But, your ws.on("close"), instead of resolve, use reject
What version of Elysia is running?
1.2.10
What platform is your computer?
Linux 6.1.0-23-amd64 x86_64 unknown
What steps can reproduce the bug?
What is the expected behavior?
When the server websocket
beforeHandle()
returnsws.error(403, 'forbidden')
I would expect the client websocket on error to be called with the 403 forbidden error.What do you see instead?
Instead of the on error callback, the on close callback is called and the websocket status code is 1002 with no trace of the 403 code
Additional information
No response
Have you try removing the
node_modules
andbun.lockb
and try again yet?yes
The text was updated successfully, but these errors were encountered: