do only use output cache when env != dev

This commit is contained in:
2026-04-29 11:35:28 +02:00
parent 0cdd737c2a
commit ba957bbb3d
+8 -1
View File
@@ -1,5 +1,7 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace Finch;
@@ -9,7 +11,12 @@ public static class ApplicationBuilderExtensions
{
app.UseMiddleware<FinchContextMiddleware>();
app.UseResponseCaching();
app.UseOutputCache();
IHostEnvironment env = app.ApplicationServices.GetRequiredService<IHostEnvironment>();
if (!env.IsDevelopment())
{
app.UseOutputCache();
}
if (app is WebApplication webApplication)
{