backend: skip http context setting for LiveKit webhooks and remove clearing context
This commit is contained in:
parent
d9ec6d687f
commit
8f6af28bc2
@ -2,14 +2,13 @@ import { NextFunction, Request, Response } from 'express';
|
|||||||
import { container } from '../config/dependency-injector.config.js';
|
import { container } from '../config/dependency-injector.config.js';
|
||||||
import { HttpContextService } from '../services/index.js';
|
import { HttpContextService } from '../services/index.js';
|
||||||
|
|
||||||
export const httpContextMiddleware = (req: Request, res: Response, next: NextFunction) => {
|
export const httpContextMiddleware = (req: Request, _res: Response, next: NextFunction) => {
|
||||||
|
if (req.path === '/livekit/webhook') {
|
||||||
|
// Skip setting context for LiveKit webhooks
|
||||||
|
return next();
|
||||||
|
}
|
||||||
|
|
||||||
const httpContextService = container.get(HttpContextService);
|
const httpContextService = container.get(HttpContextService);
|
||||||
httpContextService.setContext(req);
|
httpContextService.setContext(req);
|
||||||
|
|
||||||
// Clear context after response is finished
|
|
||||||
res.on('finish', () => {
|
|
||||||
httpContextService.clearContext();
|
|
||||||
});
|
|
||||||
|
|
||||||
next();
|
next();
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user