cal.pub0.org/lib/helpers/addRequestid.ts

10 lines
331 B
TypeScript
Raw Normal View History

import { nanoid } from "nanoid";
2022-03-30 12:17:55 +00:00
import { NextMiddleware } from "next-api-middleware";
export const addRequestId: NextMiddleware = async (_req, res, next) => {
2022-04-08 16:08:26 +00:00
// Apply header with unique ID to every request
2022-03-30 12:17:55 +00:00
res.setHeader("Calcom-Response-ID", nanoid());
// Let remaining middleware and API route execute
await next();
};