Allow to raise HTTPException before websocket.accept()#2725
Conversation
adriangb
left a comment
There was a problem hiding this comment.
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.