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

Please return different error when server responds with non-101 status code #35

Open
sirzooro opened this issue Apr 8, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@sirzooro
Copy link

sirzooro commented Apr 8, 2023

fasthttp/websocket module returns "websocket: bad handshake" error when HTTP response code is different than 101 or header values are incorrect. This hides any other non-websocket HTTP errors like 401 Unauthorized, 404 Not Found, 500 Internal Server Error, etc. Recently I was debugging one such issue and had to modify fasthttp/websocket to see what was wrong. Please add new error to report non-101 response from server. Make sure to allow getting HTTP status code from error - some errors may need special handling beside logging, e.g. prompt user for credentials when server returns 401 Unauthorized.

https://github.com/fasthttp/websocket/blob/master/client.go#L393-L396

@savsgio
Copy link
Member

savsgio commented Jul 18, 2023

Hi @sirzooro,

Could you make a PR to fix that?. Please!

Sorry for my delayed answer!

@savsgio savsgio added the bug Something isn't working label Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants