Skip to content

[possible bug] 'code' is not labeled as optional #340

Closed
@caleb15

Description

@caleb15

In https://asgi.readthedocs.io/en/latest/specs/www.html#disconnect-receive-event-ws it does not say code is optional, yet it says "as per websocket spec", where code is optional ("may contain"). Later on in Close - send event it explicitly mentions that the code there is optional. In the first link should code be optional or required?

If code is optional I would be happy to submit a PR to this repo to update the docs.

This is not just a theoretical question, as we are facing a bug that may be related to this. In https://github.com/django/channels/blob/38324816c115567e198a573bc294d8345df5e8a9/channels/generic/websocket.py#L105 channels assumes that the code key exists, but in our case it doesn't exist and a KeyError is raised.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions