fix: Fixed exception when API returns non-JSON data

This commit is contained in:
LWR
2024-12-01 23:54:51 +08:00
parent a7df9e58de
commit f50b81e958
+1 -1
View File
@@ -134,7 +134,7 @@ async def request(method: str,
content_type = resp.headers.get("content-type") content_type = resp.headers.get("content-type")
# 不是 application/json # 不是 application/json
if content_type.lower().index("application/json") == -1: if content_type.lower().find("application/json") == -1:
raise ResponseException("响应不是 application/json 类型") raise ResponseException("响应不是 application/json 类型")
raw_data = await resp.text() raw_data = await resp.text()