backend: skip http context setting for LiveKit webhooks and remove clearing context

This commit is contained in:
juancarmore 2025-09-29 14:53:50 +02:00
parent d9ec6d687f
commit 8f6af28bc2

View File

@ -2,14 +2,13 @@ import { NextFunction, Request, Response } from 'express';
import { container } from '../config/dependency-injector.config.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);
httpContextService.setContext(req);
// Clear context after response is finished
res.on('finish', () => {
httpContextService.clearContext();
});
next();
};