()
| 15 | }); |
| 16 | |
| 17 | async function setupServer() { |
| 18 | const fastify = Fastify({ logger: true, disableRequestLogging: true }); |
| 19 | await fastify.register(cookies); |
| 20 | await fastify.register(csrf); |
| 21 | // eslint-disable-next-line @typescript-eslint/unbound-method |
| 22 | fastify.addHook('onRequest', fastify.csrfProtection); |
| 23 | |
| 24 | fastify.get('/', (_req, reply) => { |
| 25 | void reply.send({ foo: 'bar' }); |
| 26 | }); |
| 27 | return fastify; |
| 28 | } |
| 29 | |
| 30 | describe('CSRF protection', () => { |
| 31 | let fastify: FastifyInstance; |
no test coverage detected