Skip to content

Commit

Permalink
perf(index): use optional chaining (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs authored Jan 6, 2025
1 parent 376ce27 commit 2346cdd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function fastifyResponseValidation (fastify, opts, next) {

function onRoute (routeOpts) {
if (routeOpts.responseValidation === false) return
if (routeOpts.schema && routeOpts.schema.response) {
if (routeOpts.schema?.response) {
const responseStatusCodeValidation = routeOpts.responseStatusCodeValidation || opts.responseStatusCodeValidation || false
routeOpts.preSerialization = routeOpts.preSerialization || []
routeOpts.preSerialization.push(buildHook(routeOpts.schema.response, responseStatusCodeValidation))
Expand Down

0 comments on commit 2346cdd

Please # to comment.