Skip to content

Commit

Permalink
fix: for quickfix, fixing that endpoint middleware fires after custom…
Browse files Browse the repository at this point in the history
… one
  • Loading branch information
kwinkel committed May 31, 2023
1 parent 9fea79b commit b236aac
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Api/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using ELifeRPG.Application;
using ELifeRPG.Core.Api.OpenAPI;
using Microsoft.AspNetCore.Http.Json;
using Microsoft.Extensions.Primitives;
using OpenTelemetry.Trace;

var builder = WebApplication.CreateBuilder(args);
Expand Down Expand Up @@ -37,12 +38,12 @@
app.Use(async (context, next) =>
{
if (context.Request.Method.Equals("post", StringComparison.OrdinalIgnoreCase) &&
context.Request.Headers["content-type"].Equals("x-www-form-urlencoded"))
context.Request.Headers.ContentType.Equals("x-www-form-urlencoded"))
{
context.Request.Headers["content-type"] = "application/json";
context.Request.Headers.ContentType = new StringValues("application/json");
}

await next();
await next(context);
});

if (app.Environment.IsDevelopment())
Expand All @@ -51,6 +52,7 @@
app.UseSwaggerUI();
}

app.UseRouting();
app
.MapInternalEndpoints()
.MapAccountEndpoints()
Expand Down

0 comments on commit b236aac

Please sign in to comment.