From 443bd200873d1a49d5f06767cb57e8226edfd447 Mon Sep 17 00:00:00 2001 From: Johannes Wienke Date: Wed, 14 Jul 2021 14:59:54 +0200 Subject: [PATCH] Pass through Werkzeug exception headers to problem (#1299) 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 --- connexion/apps/flask_app.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/connexion/apps/flask_app.py b/connexion/apps/flask_app.py index 433c844a8..a92e7f4ca 100644 --- a/connexion/apps/flask_app.py +++ b/connexion/apps/flask_app.py @@ -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)