From f50b81e958f44eb85ef046bbf35c1f32c71e6d70 Mon Sep 17 00:00:00 2001 From: LWR Date: Sun, 1 Dec 2024 23:54:51 +0800 Subject: [PATCH] fix: Fixed exception when API returns non-JSON data --- starbot/utils/network.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/starbot/utils/network.py b/starbot/utils/network.py index 4939de1..a8084f6 100644 --- a/starbot/utils/network.py +++ b/starbot/utils/network.py @@ -134,7 +134,7 @@ async def request(method: str, content_type = resp.headers.get("content-type") # 不是 application/json - if content_type.lower().index("application/json") == -1: + if content_type.lower().find("application/json") == -1: raise ResponseException("响应不是 application/json 类型") raw_data = await resp.text()