fix API 404 response to return exception detail, add WebSocket RF alias
This commit is contained in:
@@ -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",
|
||||||
|
|||||||
@@ -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}")
|
||||||
|
|||||||
Reference in New Issue
Block a user