From 2e87c40434bef79d51674790e1c39260f59d4bf0 Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Sun, 27 Sep 2020 12:37:15 +0800 Subject: [PATCH] :bug: fix error ws closing --- nonebot/drivers/fastapi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nonebot/drivers/fastapi.py b/nonebot/drivers/fastapi.py index 9b95a462..8a52b3df 100644 --- a/nonebot/drivers/fastapi.py +++ b/nonebot/drivers/fastapi.py @@ -200,8 +200,8 @@ class Driver(BaseDriver): websocket=ws) else: logger.warning("Unknown adapter") - raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, - detail="adapter not found") + await ws.close(code=status.WS_1008_POLICY_VIOLATION) + return await ws.accept() self._clients[x_self_id] = bot