Fix HTTPAction close logic

This commit is contained in:
Roland Thomas Jr 2025-05-08 00:51:34 -04:00
parent 880d86d47d
commit 26aab7f2d5
Signed by: roland
GPG Key ID: 7C3C2B085A4C2872
1 changed files with 19 additions and 19 deletions

View File

@ -105,10 +105,10 @@ class HTTPAction(Action):
session = aiohttp.ClientSession() session = aiohttp.ClientSession()
context.set("http_session", session) context.set("http_session", session)
context.set("_session_should_close", True) context.set("_session_should_close", True)
else: else:
session = aiohttp.ClientSession() session = aiohttp.ClientSession()
try:
async with session.request( async with session.request(
self.method, self.method,
self.url, self.url,
@ -124,7 +124,7 @@ class HTTPAction(Action):
"headers": dict(response.headers), "headers": dict(response.headers),
"body": body, "body": body,
} }
finally:
if not self.shared_context: if not self.shared_context:
await session.close() await session.close()