Flask has change how it handles werkzeug.routing.RequestRedirect, we need to add an errorhandler so that the request does the right thing.

Refer to: https://github.com/pallets/flask/issues/671#issuecomment-305394901
This commit is contained in:
Rebecca Law
2018-05-30 14:54:25 +01:00
parent 869e5cd766
commit 886ed01638

View File

@@ -36,6 +36,7 @@ from notifications_utils.formatters import formatted_list
from notifications_utils.sanitise_text import SanitiseASCII
from werkzeug.exceptions import abort
from werkzeug.local import LocalProxy
from werkzeug.routing import RequestRedirect
from app import proxy_fix
from app.config import configs
@@ -580,6 +581,10 @@ def register_errorhandlers(application): # noqa (C901 too complex)
), 400)
return useful_headers_after_request(resp)
@application.errorhandler(RequestRedirect)
def handle_301(error):
return error
@application.errorhandler(500)
@application.errorhandler(Exception)
def handle_bad_request(error):