Skip to content

Commit

Permalink
fix(fastify): middlewares does not have a default value provided as a…
Browse files Browse the repository at this point in the history
…rray
  • Loading branch information
Stradivario committed Jun 8, 2024
1 parent 5f8bcef commit 7bf3eed
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/fastify/src/fastify.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class FastifyModule {
return pipe(
addSchema(schemas),
globalErrorHandler(options.globalErrorHandler),
addMiddlewares(options.middlewares)
addMiddlewares(options.middlewares || [])
)(instance);
},
},
Expand Down
2 changes: 1 addition & 1 deletion packages/fastify/src/helpers/hooks/add-middlewares.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { FastifyInstance } from 'fastify';
export type Middleware = (instance: FastifyInstance) => FastifyInstance;

export function addMiddlewares(
middlewares: Middleware[]
middlewares: Middleware[] = []
): Reader<FastifyInstance, FastifyInstance> {
return (instance) => {
for (const middleware of middlewares) {
Expand Down

0 comments on commit 7bf3eed

Please sign in to comment.