Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Commit

Permalink
identified and added an aditional mark
Browse files Browse the repository at this point in the history
  • Loading branch information
YasinKaryagdi committed Jun 13, 2024
1 parent c8f9434 commit 17c4a75
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions discord/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,18 @@
Response = Coroutine[Any, Any, T]


@test(2)
@test(3)
async def json_or_text(response: aiohttp.ClientResponse) -> Union[Dict[str, Any], str]:
text = await response.text(encoding='utf-8')
try:
if response.headers['content-type'] == 'application/json':
mark(0)
return utils._from_json(text)
except KeyError:
mark(1)
# Thanks Cloudflare
pass
mark(1)
mark(2)
return text


Expand Down

0 comments on commit 17c4a75

Please sign in to comment.