fastify-helmet icon indicating copy to clipboard operation
fastify-helmet copied to clipboard

Support function-based customisation in reply.helmet options

Open Tam opened this issue 5 months ago • 4 comments

Added support for passing a function to reply.helmet, allowing dynamic modification of Helmet options. Updated type definitions and included tests to validate this functionality. The aim is to make updating the existing options easier, without needing to overwrite the entire object (i.e. when modifying a specific CSP value).

await reply.helmet(opts => {
  opts.contentSecurityPolicy.directives['script-src'].push('nonce-123')
  return opts
})

Checklist

Tam avatar May 26 '25 14:05 Tam