From 7c4fd9cbf04ecd57e82fe4761f8d7976a9cb53bd Mon Sep 17 00:00:00 2001 From: Grvzard Date: Wed, 3 May 2023 16:57:00 +0800 Subject: [PATCH] Correct the RuntimeError message content in websockets (#2141) --- starlette/websockets.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/starlette/websockets.py b/starlette/websockets.py index e89579235..5aa411824 100644 --- a/starlette/websockets.py +++ b/starlette/websockets.py @@ -65,8 +65,8 @@ async def send(self, message: Message) -> None: message_type = message["type"] if message_type not in {"websocket.accept", "websocket.close"}: raise RuntimeError( - 'Expected ASGI message "websocket.connect", ' - f"but got {message_type!r}" + 'Expected ASGI message "websocket.accept" or ' + f'"websocket.close", but got {message_type!r}' ) if message_type == "websocket.close": self.application_state = WebSocketState.DISCONNECTED