Skip to content

Commit

Permalink
fix: omit error-check for 201 responses in async_call_api
Browse files Browse the repository at this point in the history
Skip error-checking for responses with a 201 status code in async_call_api, preventing false error raises for successful REST operations.
  • Loading branch information
mbrisx committed Feb 19, 2025
1 parent 8bb42b7 commit 3a2c007
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion aiogithubapi/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ async def async_call_api(
if message is not None:
if exception := MESSAGE_EXCEPTIONS.get(message):
raise exception(message)
raise GitHubException(message)
# For a 201 Created response, we assume the operation was successful and ignore any "message" field.
if not response.status == HttpStatusCode.CREATED:
raise GitHubException(message)

if endpoint == "/graphql" and response.data.get("errors", []):
raise GitHubGraphQLException(
Expand Down

0 comments on commit 3a2c007

Please sign in to comment.