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

10 lines
299 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-03-30 12:17:55 +00:00
// Apply header
res.setHeader("Calcom-Response-ID", nanoid());
// Let remaining middleware and API route execute
await next();
};