WutheringWaves/SDKServer/Middleware/NotFoundMiddleware.cs

24 lines
525 B
C#
Raw Permalink Normal View History

2024-02-07 21:41:39 +00:00
namespace SDKServer.Middleware;
public class NotFoundMiddleware
{
private readonly RequestDelegate _next;
private readonly ILogger _logger;
public NotFoundMiddleware(RequestDelegate next, ILogger<NotFoundMiddleware> logger)
{
_next = next;
_logger = logger;
}
public async Task Invoke(HttpContext ctx)
{
await _next(ctx);
if (ctx.Response.StatusCode is 404)
{
_logger.LogWarning("Unhandled: {query}", ctx.Request.Path);
}
}
}