Skip to content

Commit 3a2c007

Browse files
committed
fix: omit error-check for 201 responses in async_call_api
Skip error-checking for responses with a 201 status code in async_call_api, preventing false error raises for successful REST operations.
1 parent 8bb42b7 commit 3a2c007

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

aiogithubapi/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,9 @@ async def async_call_api(
185185
if message is not None:
186186
if exception := MESSAGE_EXCEPTIONS.get(message):
187187
raise exception(message)
188-
raise GitHubException(message)
188+
# For a 201 Created response, we assume the operation was successful and ignore any "message" field.
189+
if not response.status == HttpStatusCode.CREATED:
190+
raise GitHubException(message)
189191

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

0 commit comments

Comments
 (0)