Skip to content

Commit

Permalink
Convert status code to int to allow HTTPStatus members
Browse files Browse the repository at this point in the history
  • Loading branch information
chbndrhnns committed May 28, 2024
1 parent 39da1f2 commit b7ec3da
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion connexion/decorators/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def _unpack_handler_response(
elif len(handler_response) == 2:
data, status_code_or_headers = handler_response
if isinstance(status_code_or_headers, int):
status_code = status_code_or_headers
status_code = int(status_code_or_headers)
elif isinstance(status_code_or_headers, Enum) and isinstance(
status_code_or_headers.value, int
):
Expand Down
6 changes: 1 addition & 5 deletions connexion/middleware/response_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,7 @@ async def wrapped_send(message: t.MutableMapping[str, t.Any]) -> None:
if message["status"] < 400:
self.validate_mime_type(mime_type)

try:
status = str(message["status"].value)
except AttributeError:
status = str(message["status"])

status = str(message["status"])
response_definition = self._operation.response_definition(
status, mime_type
)
Expand Down

0 comments on commit b7ec3da

Please sign in to comment.