Skip to content

Commit

Permalink
Replace deprecated context.config with routeConfig (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
Art Vandelay committed Oct 1, 2022
1 parent 7afa957 commit 0118f8a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
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

0 comments on commit 0118f8a

Please sign in to comment.