🐛 fix missing json encode for cqhttp http

This commit is contained in:
yanyongyu 2021-07-04 23:23:39 +08:00
parent 8e915f808b
commit 3571a5fdc0

View File

@ -349,7 +349,7 @@ class Bot(BaseBot):
elif not api_root.endswith("/"):
api_root += "/"
headers = {}
headers = {"Content-Type": "application/json"}
if self.cqhttp_config.access_token is not None:
headers[
"Authorization"] = "Bearer " + self.cqhttp_config.access_token
@ -358,7 +358,7 @@ class Bot(BaseBot):
async with httpx.AsyncClient(headers=headers) as client:
response = await client.post(
api_root + api,
json=data,
content=json.dumps(data, cls=DataclassEncoder),
timeout=self.config.api_timeout)
if 200 <= response.status_code < 300: