You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In summary, Flask-Talisman does setup in an @app.before_request method which is expected to be done by the time it runs an @app.after_request method. However, if an exception occurs in an @app.before_request method that runs before Flask-Talisman's, and that exception is caught by an @app.errorhandler, then Flask-Talisman's @app.after_request method can be run without the setup work ever being done.
The text was updated successfully, but these errors were encountered:
Changing Flask's behavior would be incorrect, as before request handlers are allowed to exit early and return a response (an exception is a response). This would just cause all the before handlers that expect earlier handlers to run to fail too.
Expected Behavior
All methods added with
@app.before_request
should be run.Actual Behavior
If an exception occurs in a single
@app.before_request
method, all following@app.before_request
methods will not run.Context
For a detailed example of this causing an issue, see GoogleCloudPlatform/flask-talisman#22.
In summary, Flask-Talisman does setup in an
@app.before_request
method which is expected to be done by the time it runs an@app.after_request
method. However, if an exception occurs in an@app.before_request
method that runs before Flask-Talisman's, and that exception is caught by an@app.errorhandler
, then Flask-Talisman's@app.after_request
method can be run without the setup work ever being done.The text was updated successfully, but these errors were encountered: