diff --git a/discohook/middleware.py b/discohook/middleware.py index dc0c57b..007664c 100644 --- a/discohook/middleware.py +++ b/discohook/middleware.py @@ -12,6 +12,7 @@ class SingleUseSession(BaseHTTPMiddleware): """ async def dispatch(self, request: Request, rre: RequestResponseEndpoint): - await request.app.http.session.close() + if request.app.http.session: + await request.app.http.session.close() request.app.http.session = aiohttp.ClientSession("https://discord.com") return await rre(request)