Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated context.config with routeConfig #204

Merged
merged 1 commit into from
Oct 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async function helmetPlugin (fastify, options) {
})

fastify.addHook('onRequest', async (request, reply) => {
const { helmet: routeOptions } = request.context.config
const { helmet: routeOptions } = request.routeConfig

if (typeof routeOptions !== 'undefined') {
const { enableCSPNonces: enableRouteCSPNonces, skipRoute, ...helmetRouteConfiguration } = routeOptions
Expand All @@ -50,7 +50,7 @@ async function helmetPlugin (fastify, options) {
})

fastify.addHook('onRequest', (request, reply, next) => {
const { helmet: routeOptions } = request.context.config
const { helmet: routeOptions } = request.routeConfig

if (typeof routeOptions !== 'undefined') {
const { enableCSPNonces: enableRouteCSPNonces, skipRoute, ...helmetRouteConfiguration } = routeOptions
Expand Down
2 changes: 1 addition & 1 deletion test/global.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ test('It should not return a fastify `FST_ERR_REP_ALREADY_SENT - Reply already s
}

// We want to crash in the scope of this test
const crash = request.context.config.fail
const crash = request.routeConfig.fail

Promise.resolve(crash).then((fail) => {
if (fail === true) {
Expand Down