diff --git a/index.js b/index.js index 718b3b3..28dfc9a 100644 --- a/index.js +++ b/index.js @@ -137,7 +137,7 @@ function handleCorsOptionsCallbackDelegator (optionsResolver, fastify, req, repl * @param {import('./types').FastifyCorsOptions} opts */ function normalizeCorsOptions (opts) { - const corsOptions = Object.assign({}, defaultOptions, opts) + const corsOptions = { ...defaultOptions, ...opts } if (Array.isArray(opts.origin) && opts.origin.indexOf('*') !== -1) { corsOptions.origin = '*' }