fix(nestlogged): add url parsing from request logic for middleware

This commit is contained in:
Shinwoo PARK 2025-03-30 03:21:51 +09:00
parent 5519bac09a
commit 5525454baf

View File

@ -126,12 +126,15 @@ export function overrideBuild<F extends Array<any>, R>(
}
// If this is ExecutionContext based function (e.g. Guard, Interceptor) get Request from Context
if (type === 'guard' || type === 'interceptor' || type === 'middleware') {
if (type === 'guard' || type === 'interceptor') {
const context = args[0] as ExecutionContext;
if (context.getType() === 'http') {
const req = context.switchToHttp().getRequest();
route = req.url;
}
} else if (type === 'middleware') {
const req = args[0];
route = req.url;
}
// Start Log