Fix HTTPAction close logic
This commit is contained in:
@ -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()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user