mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-12-04 22:42:21 +00:00
Allow use of orjson instead of json
The difference in speed seems negligible at start up, which is when most time is taken for actually parsing JSON. I could potentially be missing something but profiling didn't point to any discernable difference.
This commit is contained in:
@@ -99,7 +99,7 @@ async def json_or_text(response: aiohttp.ClientResponse) -> Union[Dict[str, Any]
|
||||
text = await response.text(encoding='utf-8')
|
||||
try:
|
||||
if response.headers['content-type'] == 'application/json':
|
||||
return json.loads(text)
|
||||
return utils.from_json(text)
|
||||
except KeyError:
|
||||
# Thanks Cloudflare
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user