Skip to content

Commit

Permalink
Merge pull request #61 from nottrobin/set-clacks
Browse files Browse the repository at this point in the history
Set X-Clacks-Overhead to keep Terry Pratchett in the network
  • Loading branch information
nottrobin authored May 12, 2022
2 parents bf69a7a + 4139e7a commit 4aa8507
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions canonicalwebteam/flask_base/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,17 @@ def set_permissions_policy_headers(response):
return response


def set_clacks(response):
"""
Keep Sir Terry Pratchett's name alive
https://xclacksoverhead.org/home/about
"""

response.headers["X-Clacks-Overhead"] = "GNU Terry Pratchett"

return response


class FlaskBase(flask.Flask):
def send_static_file(self, filename: str) -> "flask.wrappers.Response":
"""
Expand Down Expand Up @@ -219,6 +230,7 @@ def __init__(
self.after_request(set_security_headers)
self.after_request(set_cache_control_headers)
self.after_request(set_permissions_policy_headers)
self.after_request(set_clacks)

self.context_processor(base_context)

Expand Down

0 comments on commit 4aa8507

Please sign in to comment.