Skip to content

Instantly share code, notes, and snippets.

@nigelhanlon
Created June 7, 2018 08:29
Show Gist options
  • Save nigelhanlon/91c843e29d72ab15ce98f08e39bca4c2 to your computer and use it in GitHub Desktop.
Save nigelhanlon/91c843e29d72ab15ce98f08e39bca4c2 to your computer and use it in GitHub Desktop.
Add an X-Clacks header to all fastify responses
// See https://xclacksoverhead.org/home/about for more information.
// This adds a simple header via Hooks (https://www.fastify.io/docs/latest/Hooks/)
fastify.addHook('onResponse', (res, next) => {
res.set('X-Clacks-Overhead', 'GNU Terry Pratchett');
next()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment