Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Websocket tests do not fail properly on 401/403 errors #816

Closed
chris-lindstrom opened this issue Oct 28, 2024 · 1 comment
Closed

Websocket tests do not fail properly on 401/403 errors #816

chris-lindstrom opened this issue Oct 28, 2024 · 1 comment

Comments

@chris-lindstrom
Copy link

I have some websocket tests and I noticed that when I set the AAD token such that I get either 401 or 403 responses from the server (as opposed to 101 upgrade) - the tests don't run properly. When I run locally - the test will time out after 2 minutes. When I run in the docker image - it returns after 2 minutes but does not report any error ($? = 0)

I found code in the ws module (websocket.js) req.on('response') line 884: https://github.com/websockets/ws/blob/master/lib/websocket.js if I hacked up the code to abortHandshake on 401 - this worked more like I expected.

I can see that 401 responses go into unexpected-response - and httpyac has code registering this - but I got lost somewhere in the emit DispatchEvent. https://github.com/AnWeber/httpyac/blob/main/src/models/requestClient.ts#L80

I feel like I probably should be able to add a hook for this - but haven't had any luck figuring out where to put my hook so far.

@AnWeber
Copy link
Owner

AnWeber commented Oct 28, 2024

@chris-lindstrom unexpected-response is only used in the meta-data case. These were events that sound interesting to me and might be helpful. However, I would currently expect to get an explicit error event. But unfortunately websocket only seems to execute the abortHandshake if I don't have a handler for unexpected-response. I remove the event listener

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants