Update to .NET 8

This commit is contained in:
AeonLucid
2024-07-01 21:52:30 +02:00
parent 2cca797496
commit 3691d229d5
17 changed files with 54 additions and 47 deletions
@@ -1,6 +1,6 @@
using System.Text;
using System.Text.Json;
using Microsoft.AspNetCore.Http.Extensions;
using Newtonsoft.Json;
namespace Prospect.Server.Api.Middleware;
@@ -45,7 +45,12 @@ public class RequestLoggerMiddleware
var body = await reader.ReadToEndAsync();
if (body.StartsWith("{"))
{
return JsonConvert.SerializeObject(JsonConvert.DeserializeObject(body), Formatting.Indented);
var bodyJson = JsonSerializer.SerializeToUtf8Bytes(JsonSerializer.Deserialize<object>(body), new JsonSerializerOptions
{
WriteIndented = true
});
return Encoding.UTF8.GetString(bodyJson);
}
return body;