mirror of
				https://github.com/nonebot/nonebot2.git
				synced 2025-10-30 14:36:41 +00:00 
			
		
		
		
	🐛 fix missing json encode for cqhttp http
This commit is contained in:
		| @@ -349,7 +349,7 @@ class Bot(BaseBot): | |||||||
|             elif not api_root.endswith("/"): |             elif not api_root.endswith("/"): | ||||||
|                 api_root += "/" |                 api_root += "/" | ||||||
|  |  | ||||||
|             headers = {} |             headers = {"Content-Type": "application/json"} | ||||||
|             if self.cqhttp_config.access_token is not None: |             if self.cqhttp_config.access_token is not None: | ||||||
|                 headers[ |                 headers[ | ||||||
|                     "Authorization"] = "Bearer " + self.cqhttp_config.access_token |                     "Authorization"] = "Bearer " + self.cqhttp_config.access_token | ||||||
| @@ -358,7 +358,7 @@ class Bot(BaseBot): | |||||||
|                 async with httpx.AsyncClient(headers=headers) as client: |                 async with httpx.AsyncClient(headers=headers) as client: | ||||||
|                     response = await client.post( |                     response = await client.post( | ||||||
|                         api_root + api, |                         api_root + api, | ||||||
|                         json=data, |                         content=json.dumps(data, cls=DataclassEncoder), | ||||||
|                         timeout=self.config.api_timeout) |                         timeout=self.config.api_timeout) | ||||||
|  |  | ||||||
|                 if 200 <= response.status_code < 300: |                 if 200 <= response.status_code < 300: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user