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

Allow WebSocket close event to receive reason being None from ASGI app #1259

Merged
merged 1 commit into from
Nov 23, 2021

Conversation

Kludex
Copy link
Sponsor Member

@Kludex Kludex commented Nov 22, 2021

This is a small fix to the "reason" key on the WebSocket close event. According to the ASGI specs, the application can send None on the "reason" field:

`reason` (Unicode string) – A reason given for the closure, can be any string. Optional; if missing or `None` default is empty string.

This PR adds the possibility from the server to send None, and if that's the case, it will default to empty string.

Reference: https://asgi.readthedocs.io/en/latest/specs/www.html#close-send-event

@Kludex Kludex merged commit 1e95a8f into encode:master Nov 23, 2021
Kludex added a commit to sephioh/uvicorn that referenced this pull request Oct 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants