mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-18 10:36:22 +08:00
fix(server): set reqeust-id on ClsModule setup (#9829)
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
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();
|
||||
};
|
||||
Reference in New Issue
Block a user