-
-
Notifications
You must be signed in to change notification settings - Fork 951
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
Allow to raise HTTPException
before websocket.accept()
#2725
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! What happens if you raise the exception after accepting? I assume it's unchanged and basically undefined behavior, but it would be nice to document and maybe give users an informative error in the future?
We can do that, yep. |
That's great! We can merge this as is then or if you want to add a slightly better error message for that case feel free to do so. |
I think we have an issue on the |
Before the
websocket.accept()
is called, we can actually return a different response... Right now it can be done withwebsocket.send_denial_response()
, which I'm not sure it was the best choice of API, maybe we shouldn't have added that method, but just used theHTTPException
.Reviews are welcome. I want to make a release on October 15.