mirror of
				https://github.com/nonebot/nonebot2.git
				synced 2025-10-31 06:56:39 +00:00 
			
		
		
		
	🐛 validate schema field & fix request construct
				
					
				
			This commit is contained in:
		| @@ -131,6 +131,10 @@ class Bot(BaseBot): | |||||||
|                     "challenge": challenge |                     "challenge": challenge | ||||||
|                 }).encode()) |                 }).encode()) | ||||||
|  |  | ||||||
|  |         schema = data.get("schema") | ||||||
|  |         if not schema: | ||||||
|  |             return None, HTTPResponse(400, b"Missing `schema` in POST body, only accept event of version 2.0") | ||||||
|  |  | ||||||
|         headers = data.get("header") |         headers = data.get("header") | ||||||
|         if headers: |         if headers: | ||||||
|             token = headers.get("token") |             token = headers.get("token") | ||||||
| @@ -230,7 +234,8 @@ 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( | ||||||
|                         self.api_root + api, |                         self.api_root + api, | ||||||
|                         json=data, |                         json=data["body"], | ||||||
|  |                         params=data["query"], | ||||||
|                         timeout=self.config.api_timeout) |                         timeout=self.config.api_timeout) | ||||||
|  |  | ||||||
|                 print(response.json()) |                 print(response.json()) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user