Skip to content

Commit

Permalink
aiohttp client uses context manager.
Browse files Browse the repository at this point in the history
  • Loading branch information
dapper91 committed Dec 15, 2023
1 parent 15f7813 commit 07e872d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pjrpc/client/backend/aiohttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ async def _request(self, request_text: str, is_notification: bool = False, **kwa
headers = kwargs.setdefault('headers', {})
headers['Content-Type'] = pjrpc.common.DEFAULT_CONTENT_TYPE

resp = await self._session.post(self._endpoint, data=request_text, **kwargs)
resp.raise_for_status()
async with self._session.post(self._endpoint, data=request_text, **kwargs) as resp:
resp.raise_for_status()
response_text = await resp.text()

response_text = await resp.text()
if is_notification:
return None

Expand Down

0 comments on commit 07e872d

Please sign in to comment.