LANCommander/LANCommander.Server/ApiMiddleware.cs
2024-08-04 18:44:33 -05:00

26 lines
601 B
C#

using LANCommander.Server.Services;
namespace LANCommander.Server
{
public class ApiMiddleware
{
private readonly RequestDelegate Next;
public ApiMiddleware(RequestDelegate next)
{
Next = next;
}
public async Task InvokeAsync(HttpContext context)
{
context.Response.OnStarting(() =>
{
context.Response.Headers["X-API-Version"] = UpdateService.GetCurrentVersion().ToString();
return Task.CompletedTask;
});
await Next(context);
}
}
}