Skip to content

Commit

Permalink
Asynchronously stream HTTP responses
Browse files Browse the repository at this point in the history
  • Loading branch information
dolfies committed Dec 10, 2024
1 parent 1992b4e commit c0710eb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions discord/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ async def json_or_text(response: Union[aiohttp.ClientResponse, requests.Response
if isinstance(response, aiohttp.ClientResponse):
text = await response.text(encoding='utf-8')
else:
text = response.content.decode('utf-8')
text = await response.atext()

try:
if response.headers['content-type'] == 'application/json':
Expand Down Expand Up @@ -814,7 +814,7 @@ async def request(
headers['X-Failed-Requests'] = str(failed)

try:
response = await self.__session.request(method, url, **kwargs)
response = await self.__session.request(method, url, **kwargs, stream=True)
response.status = response.status_code # type: ignore
response.reason = HTTPStatus(response.status_code).phrase
_log.debug('%s %s with %s has returned %s.', method, url, kwargs.get('data'), response.status_code)
Expand Down

0 comments on commit c0710eb

Please sign in to comment.