Add a friendly GET /api/ws response
CI/CD / backend (pull_request) Canceled after 0s
CI/CD / frontend (pull_request) Canceled after 0s
CI/CD / build (pull_request) Canceled after 0s
CI/CD / deploy (pull_request) Canceled after 0s
CI/CD / cleanup (pull_request) Canceled after 0s

A plain browser hit on the socket URL now returns a JSON hint instead of a
confusing 404/426. Companion to the Basic-auth bypass on /api/ws.
This commit is contained in:
matitos committed 2026-09-19 13:41:55 +00:00
1 parent d0b941e305
commit 386137c90e
1 file changed
+9
+9
View File
@@ -191,6 +191,15 @@ async def close_position(
return engine.status()
@router.get("/ws")
def websocket_info() -> dict[str, str]:
"""A plain browser hit on the socket URL gets a clear hint, not a 404/426."""
return {
"detail": "This endpoint is a WebSocket. Connect with a WebSocket client.",
"path": "/api/ws",
}
@router.websocket("/ws")
async def websocket_endpoint(websocket: WebSocket) -> None:
runtime: Runtime = websocket.app.state.runtime