Skip to content

Commit

Permalink
Merge pull request #127 from foarsitter/foarsitter-patch-1
Browse files Browse the repository at this point in the history
TypeAdapter support for asend
  • Loading branch information
foarsitter authored Oct 10, 2024
2 parents b550588 + 1bfb116 commit 7779c4c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/requestmodel/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ async def asend(self, client: AsyncClient) -> ResponseType:
r = self.as_request(client)
self.raw_response = await client.send(r)
self.handle_error(self.raw_response)
if isinstance(self.response_model, TypeAdapter):
return self.response_model.validate_python(self.raw_response.json())
return self.response_model.model_validate(self.raw_response.json())

def as_request(self, client: BaseClient) -> Request:
Expand Down

0 comments on commit 7779c4c

Please sign in to comment.