From 5a6328f292e92e41cac1bdc49b8f08d738f38416 Mon Sep 17 00:00:00 2001 From: Frazer Smith Date: Thu, 2 Jan 2025 11:16:19 +0000 Subject: [PATCH] perf(index): use optional chaining Signed-off-by: Frazer Smith --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 2f7cc9b..a4da647 100644 --- a/index.js +++ b/index.js @@ -74,7 +74,7 @@ async function fastifyBasicAuth (fastify, opts) { const useUtf8 = opts.utf8 ?? true const charset = useUtf8 ? 'utf-8' : 'ascii' const authenticateHeader = getAuthenticateHeader(opts.authenticate, useUtf8) - const header = (opts.header && opts.header.toLowerCase()) || 'authorization' + const header = opts.header?.toLowerCase() || 'authorization' const credentialsRE = strictCredentials ? credentialsStrictRE