diff --git a/channels/generic/websocket.py b/channels/generic/websocket.py index 42e5c54e..04096046 100644 --- a/channels/generic/websocket.py +++ b/channels/generic/websocket.py @@ -200,7 +200,7 @@ async def websocket_receive(self, message): Called when a WebSocket frame is received. Decodes it and passes it to receive(). """ - if "text" in message and message["text"] is not None: + if message.get("text") is not None: await self.receive(text_data=message["text"]) else: await self.receive(bytes_data=message["bytes"])