mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 21:27:20 +00:00
17 lines
403 B
TypeScript
17 lines
403 B
TypeScript
import { NextFunction, Request, Response } from 'express';
|
|
import { ClsServiceManager } from 'nestjs-cls';
|
|
import onHeaders from 'on-headers';
|
|
|
|
export const responseRequestIdHeader = (
|
|
_req: Request,
|
|
res: Response,
|
|
next: NextFunction
|
|
) => {
|
|
onHeaders(res, () => {
|
|
const requestId = ClsServiceManager.getClsService().getId();
|
|
res.setHeader('X-Request-Id', requestId);
|
|
});
|
|
|
|
next();
|
|
};
|