Skip to content

Commit

Permalink
Merge pull request #101 from dapper91/aiohttp-client-fix
Browse files Browse the repository at this point in the history
- aiohttp client uses context manager.
  • Loading branch information
dapper91 authored Dec 15, 2023
2 parents 15f7813 + 07e872d commit decb953
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 decb953

Please sign in to comment.