Skip to content

Commit d192401

Browse files
authored
fix: request route config deprecation - fixes #229 (#230)
1 parent cf8b6cd commit d192401

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ async function fastifyHelmet (fastify, options) {
3535

3636
fastify.addHook('onRequest', async (request, reply) => {
3737
/* istanbul ignore next */
38-
const { helmet: routeOptions } = request.routeConfig || request.context.config
38+
const { helmet: routeOptions } = request.routeOptions.config || request.context.config
3939

4040
if (typeof routeOptions !== 'undefined') {
4141
const { enableCSPNonces: enableRouteCSPNonces, skipRoute, ...helmetRouteConfiguration } = routeOptions
@@ -52,7 +52,7 @@ async function fastifyHelmet (fastify, options) {
5252

5353
fastify.addHook('onRequest', (request, reply, next) => {
5454
/* istanbul ignore next */
55-
const { helmet: routeOptions } = request.routeConfig || request.context.config
55+
const { helmet: routeOptions } = request.routeOptions.config || request.context.config
5656

5757
if (typeof routeOptions !== 'undefined') {
5858
const { enableCSPNonces: enableRouteCSPNonces, skipRoute, ...helmetRouteConfiguration } = routeOptions

test/global.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ test('It should not return a fastify `FST_ERR_REP_ALREADY_SENT - Reply already s
685685
}
686686

687687
// We want to crash in the scope of this test
688-
const crash = request.routeConfig.fail
688+
const crash = request.routeOptions.config.fail
689689

690690
Promise.resolve(crash).then((fail) => {
691691
if (fail === true) {

0 commit comments

Comments
 (0)