Created
June 7, 2018 08:29
-
-
Save nigelhanlon/91c843e29d72ab15ce98f08e39bca4c2 to your computer and use it in GitHub Desktop.
Add an X-Clacks header to all fastify responses
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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