Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Talisman is not working when overwriting the process_response #23

Open
lipis opened this issue Apr 16, 2018 · 1 comment
Open

Talisman is not working when overwriting the process_response #23

lipis opened this issue Apr 16, 2018 · 1 comment

Comments

@lipis
Copy link
Contributor

lipis commented Apr 16, 2018

In the following (minimal) app the CSP headers are not present when running the app.

from flask import Flask
from flask_talisman import Talisman


class MyFlask(Flask):
  def process_response(self, response):
    return response

# Replace MyFlask with Flask and the CPH headers will work
application = MyFlask(__name__)
talisman = Talisman(application)


@application.route('/')
def index():
  return 'Hello, world!'


if __name__ == '__main__':
  application.run(host='0.0.0.0', port=8080)

What would be the best way too modify the response and have the Talisman support? Is that a bug in Talisman? Am I holding it wrong?

@davidism
Copy link

davidism commented Apr 16, 2018

You removed all the code that calls after functions from process_response. Don't do that, or at least call super().process_response(response) as well. Perhaps you meant to override make_response? You typically wouldn't override process_response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants