This commit is contained in:
hz
2025-05-12 19:55:02 -07:00
parent ce4e29656f
commit d122b437bc
+14
View File
@@ -8,6 +8,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.IdentityModel.Tokens;
using System.Text;
using Microsoft.AspNetCore.Http;
var builder = WebApplication.CreateBuilder(args);
builder.WebHost.ConfigureKestrel(serverOptions => {});
@@ -82,6 +83,19 @@ builder.Services.AddCors(options =>
var app = builder.Build();
app.UseCors("AllowAll");
// Enable OPTIONS requests to reach controllers
app.Use(async (context, next) =>
{
if (context.Request.Method == HttpMethods.Options)
{
context.Response.StatusCode = 204;
return;
}
await next();
});
app.UseSwagger();
app.UseSwaggerUI();