Skip to content

Commit

Permalink
Merge pull request #69 from pdw-mb/fix-error-status-line
Browse files Browse the repository at this point in the history
Ensure that status message is included on status line
  • Loading branch information
roman-adcombo authored Jan 12, 2024
2 parents 0d032b8 + ad22482 commit 3cfff98
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion flask_combo_jsonapi/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,14 @@ def wrapper(*args, **kwargs):
try:
return func(*args, **kwargs)
except JsonApiException as e:
# If status is just a numeric code, convert it to an int so that
# flask expands it to a valid HTTP status line in the response.
try:
status = int(e.status)
except ValueError:
status = e.status
return make_response(jsonify(jsonapi_errors([e.to_dict()])),
e.status,
status,
headers)
except Exception as e:
api_ex = format_http_exception(e)
Expand Down

0 comments on commit 3cfff98

Please sign in to comment.