2022-03-29 00:25:24 +00:00
|
|
|
import { nanoid } from "nanoid";
|
2022-03-30 12:17:55 +00:00
|
|
|
import { NextMiddleware } from "next-api-middleware";
|
2022-03-29 00:25:24 +00:00
|
|
|
|
|
|
|
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();
|
|
|
|
};
|