Pre-read the response to avoid getting errors outside of the context manager

This commit is contained in:
DevilXD
2022-10-24 17:32:58 +02:00
parent bd652417dc
commit b216d41492

View File

@@ -1027,6 +1027,8 @@ class Twitch:
logger.debug(f"Response: {response.status}: {response}")
if response.status >= 500:
self.print(_("error", "site_down").format(seconds=round(delay)))
# pre-read the response to avoid getting errors outside of the context manager
await response.read()
yield response
return
except (aiohttp.ClientConnectionError, asyncio.TimeoutError):