@@ -77,6 +77,9 @@ async def __aexit__(self, exc_type, exc_val, exc_tb):
7777 async def _process_response (self , response : aiohttp .ClientResponse ) -> dict :
7878 try :
7979 response .raise_for_status ()
80+ if response .status == 204 :
81+ return {}
82+
8083 return await response .json ()
8184 except aiohttp .ClientResponseError as e :
8285 # Extract error message from response if available
@@ -89,7 +92,9 @@ async def _process_response(self, response: aiohttp.ClientResponse) -> dict:
8992
9093 # Use the error mapping to create appropriate exception
9194 error_message = str (e ) or "HTTP request failed"
92- raise error_from_status (error_message , response .status , error_data )
95+ raise error_from_status (
96+ error_message , response .status , error_data
97+ ) from e
9398
9499 async def get (
95100 self , url : str , * , headers : t .Optional [t .Dict [str , str ]] = None
@@ -183,6 +188,9 @@ async def __aexit__(self, exc_type, exc_val, exc_tb):
183188 async def _process_response (self , response : httpx .Response ) -> dict :
184189 try :
185190 response .raise_for_status ()
191+ if response .status_code == 204 :
192+ return {}
193+
186194 return response .json ()
187195 except httpx .HTTPStatusError as e :
188196 # Extract error message from response if available
@@ -195,7 +203,9 @@ async def _process_response(self, response: httpx.Response) -> dict:
195203
196204 # Use the error mapping to create appropriate exception
197205 error_message = str (e ) or "HTTP request failed"
198- raise error_from_status (error_message , response .status_code , error_data )
206+ raise error_from_status (
207+ error_message , response .status_code , error_data
208+ ) from e
199209
200210 async def get (
201211 self , url : str , * , headers : t .Optional [t .Dict [str , str ]] = None
0 commit comments