MCPcopy Index your code
hub / github.com/freeCodeCamp/freeCodeCamp / setupServer

Function setupServer

api/src/plugins/csrf.test.ts:17–28  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15});
16
17async 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
30describe('CSRF protection', () => {
31 let fastify: FastifyInstance;

Calls 1

sendMethod · 0.45

Tested by

no test coverage detected