fastapi_client
fastapi_client copied to clipboard
Missing status code 204 support.
There is no 204 status code support in api_client.py, which will cause issue when status code is 204 like set_assignee
api etc.
Current Code
async def send(self, request: Request, type_: Type[T]) -> T:
response = await self.middleware(request, self.send_inner)
if response.status_code in [200, 201]:
try:
return parse_obj_as(type_, response.json())
except ValidationError as e:
raise ResponseHandlingException(e)
raise UnexpectedResponse.for_response(response)
Issue:
Exception raised when 204 returned.
Unexpected Response: 204 (Unrecognized Status Code)
Current resolution:
We manually added 204 support as below to avoid exception.
if response.status_code == 204:
return response