Fix HTTPAction close logic
This commit is contained in:
parent
880d86d47d
commit
26aab7f2d5
|
@ -105,10 +105,10 @@ class HTTPAction(Action):
|
|||
session = aiohttp.ClientSession()
|
||||
context.set("http_session", session)
|
||||
context.set("_session_should_close", True)
|
||||
|
||||
else:
|
||||
session = aiohttp.ClientSession()
|
||||
|
||||
try:
|
||||
async with session.request(
|
||||
self.method,
|
||||
self.url,
|
||||
|
@ -124,7 +124,7 @@ class HTTPAction(Action):
|
|||
"headers": dict(response.headers),
|
||||
"body": body,
|
||||
}
|
||||
|
||||
finally:
|
||||
if not self.shared_context:
|
||||
await session.close()
|
||||
|
||||
|
|
Loading…
Reference in New Issue