Skip to content

Commit

Permalink
fix(types): use void as csrfProtection's return type (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
ojeytonwilliams authored Jul 11, 2024
1 parent 470de17 commit d8fe873
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { CookieSerializeOptions as FastifyCookieSerializeOptions } from "@fastif

declare module 'fastify' {
interface FastifyInstance {
csrfProtection(req: FastifyRequest, reply: FastifyReply, done: () => void): any;
csrfProtection(req: FastifyRequest, reply: FastifyReply, done: () => void): void;
}

interface FastifyReply {
Expand Down
2 changes: 2 additions & 0 deletions types/index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ async function run() {
return req.body
}
})

fastify.addHook('onRequest', fastify.csrfProtection)
}


Expand Down

0 comments on commit d8fe873

Please sign in to comment.