fix: Fixed exception when API returns non-JSON data
This commit is contained in:
@@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user