fastify-helmet
fastify-helmet copied to clipboard
Support function-based customisation in reply.helmet options
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
- [x] run
npm run testandnpm run benchmark - [x] tests and/or benchmarks are included
- [x] documentation is changed or added
- [x] commit message and code follows the Developer's Certification of Origin and the Code of conduct