From 3571a5fdc01158bb5c8656dbd48c66aa2d06d732 Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Sun, 4 Jul 2021 23:23:39 +0800 Subject: [PATCH] :bug: fix missing json encode for cqhttp http --- .../nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/bot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/bot.py b/packages/nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/bot.py index f1fc4b64..009efb1d 100644 --- a/packages/nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/bot.py +++ b/packages/nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/bot.py @@ -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: