@piggly/fastify-chassis
Version:
An ESM/CommonJS toolkit to help you to do common operations in your back-end applications with Fastify and NodeJS.
17 lines • 598 B
JavaScript
/**
* CSRFHeaderIssuerRoute is a route that issues a CSRF token as a header.
*
* It will return a 204 status code and a CSRF token as a header.
*
* @param {Object} deps
* @param {CSRFTokenService} deps.CSRF_SERVICE
* @param {string} [header] The header name.
* @returns Route handler.
* @since 7.0.0
* @author Caique Araujo <caique@piggly.com.br>
*/
export const CSRFHeaderIssuerRoute = (deps, header = 'X-Csrf-Token') => async (request, reply) => {
deps.CSRF_SERVICE.asHeader(reply, header);
return reply.status(204).send();
};
//# sourceMappingURL=CSRFHeaderIssuerRouter.js.map