diff --git a/aiogithubapi/client.py b/aiogithubapi/client.py index 4499ccb..efb3dbb 100644 --- a/aiogithubapi/client.py +++ b/aiogithubapi/client.py @@ -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(