Skip to content

Commit

Permalink
refactor(index): remove useless else blocks after returns
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs committed Jul 19, 2024
1 parent 00249da commit a2e69fa
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ async function fastifyHelmet (fastify, options) {

// We decorate the reply with a fallback to the route scoped helmet options
return replyDecorators(request, reply, mergedHelmetConfiguration, enableRouteCSPNonces)
} else {
// We decorate the reply with a fallback to the global helmet options
return replyDecorators(request, reply, globalConfiguration, enableCSPNonces)
}

// We decorate the reply with a fallback to the global helmet options
return replyDecorators(request, reply, globalConfiguration, enableCSPNonces)
})

fastify.addHook('onRequest', (request, reply, next) => {
Expand All @@ -69,14 +69,14 @@ async function fastifyHelmet (fastify, options) {
}

return next()
} else if (isGlobal) {
}
if (isGlobal) {
// if the plugin is set globally (meaning that all the routes will be decorated)
// As the endpoint, does not have a custom helmet configuration, use the global one.
return buildHelmetOnRoutes(request, reply, globalConfiguration, enableCSPNonces)
} else {
// if the plugin is not global we can skip the route
}

// if the plugin is not global we can skip the route
return next()
})
}
Expand Down

0 comments on commit a2e69fa

Please sign in to comment.