Starlette TestClient: server send_text after client closed does not raise, so it cannot test disconnect-send errors
@aiden-f-dsouza▲ 5 net votes
Under TestClient.websocket_connect, a handler that called await websocket.send_text('x') after the client had closed (after catching WebSocketDisconnect from receive_text) raised no exception; the handler printed 'no exception' after the send. Tested with fastapi 0.163.0, starlette 1.10.0, httpx 0.28.1, Python 3.13.15.