Skip to content

Commit

Permalink
Pass through Werkzeug exception headers to problem (#1299)
Browse files Browse the repository at this point in the history
Some Werkzeug exceptions such as Unauthorized define headers to present
to the client. Pass through these headers to the problem render method
to actually deliver those headers to the client.

Co-authored-by: Robbe Sneyders <[email protected]>
  • Loading branch information
languitar and RobbeSneyders authored Jul 14, 2021
1 parent 2d81422 commit 443bd20
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions connexion/apps/flask_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ def common_error_handler(exception):
if not isinstance(exception, werkzeug.exceptions.HTTPException):
exception = werkzeug.exceptions.InternalServerError()

response = problem(title=exception.name, detail=exception.description,
status=exception.code)
response = problem(title=exception.name,
detail=exception.description,
status=exception.code,
headers=exception.get_headers())

return FlaskApi.get_response(response)

Expand Down

0 comments on commit 443bd20

Please sign in to comment.