fix API 404 response to return exception detail, add WebSocket RF alias

This commit is contained in:
2026-06-27 19:06:55 +02:00
parent 07890aa464
commit 0be86771e1
2 changed files with 5 additions and 1 deletions

View File

@@ -14,7 +14,7 @@ async def not_found_handler(request: Request, exc: HTTPException):
if request.url.path.startswith("/api/"): if request.url.path.startswith("/api/"):
return JSONResponse( return JSONResponse(
status_code=404, status_code=404,
content={"detail": "API endpoint not found"} content={"detail": exc.detail}
) )
return render_template( return render_template(
"error.html", "error.html",

View File

@@ -25,6 +25,10 @@ class WebSocketKeywords:
asyncio.run(self._async_connect(ws_url)) asyncio.run(self._async_connect(ws_url))
return f"Connected to {ws_url}" return f"Connected to {ws_url}"
def Connect_To_WebSocket(self, ws_url: str) -> str:
"""Robot Framework alias for connect_to_websocket."""
return self.connect_to_websocket(ws_url)
async def _async_connect(self, ws_url: str) -> None: async def _async_connect(self, ws_url: str) -> None:
self._connection = await websockets.connect(ws_url) self._connection = await websockets.connect(ws_url)
logger.info(f"WebSocket connected: {self._connection}") logger.info(f"WebSocket connected: {self._connection}")