mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-05 09:26:10 +00:00
Use json_or_text helper for parsing webhook responses
This commit is contained in:
@ -178,8 +178,11 @@ class WebhookAdapter:
|
||||
response.status = response.status_code # type: ignore
|
||||
|
||||
data = response.text or None
|
||||
if data and response.headers['Content-Type'] == 'application/json':
|
||||
data = json.loads(data)
|
||||
try:
|
||||
if data and response.headers['Content-Type'] == 'application/json':
|
||||
data = json.loads(data)
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
remaining = response.headers.get('X-Ratelimit-Remaining')
|
||||
if remaining == '0' and response.status_code != 429:
|
||||
|
Reference in New Issue
Block a user