Skip to content

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

@chris-lindstrom

Description

@chris-lindstrom

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions