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

x/net/websocket: ErrBadStatus should include the bad status code #13528

Open
noahlt opened this issue Dec 8, 2015 · 0 comments

Comments

@noahlt
Copy link

commented Dec 8, 2015

Right now, if a x/net/websocket client connects to an HTTP endpoint and receives a response with any status other than 101, it returns an ErrBadStatus (source). This error does not include the actual status code received, and so users of this library are unable to distinguish between, for instance, 403 Forbidden and 500 Internal Server Error responses.

One solution would be to add a websocket.HTTPStatusError which implements websocket.ProtocolError and also includes an exported Status field. This way, users could (if they wished) check the type of the error and switch on the Status field to determine correct behavior.

@mikioh mikioh changed the title x/net/websocket.ErrBadStatus should include the bad status code x/net/websocket: ErrBadStatus should include the bad status code Dec 8, 2015

@rsc rsc added this to the Unreleased milestone Dec 28, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.