This commit is contained in:
Pilzinsel64
2025-12-03 12:10:44 +01:00
parent 222dd7ea8a
commit 061eccf846
2 changed files with 8 additions and 5 deletions

View File

@@ -507,7 +507,11 @@ public class ApiServer : IApiServer
// Read input content
Log.Debug("Read input content");
ApiMessage? message = null;
switch (context.Request.ContentType)
var contentType = context.Request.ContentType;
var contentTypeEnd = contentType?.IndexOf(';') ?? -1;
if (contentType != null && contentTypeEnd != -1)
contentType = contentType[..contentTypeEnd];
switch (contentType)
{
case "application/json":
try
@@ -515,9 +519,8 @@ public class ApiServer : IApiServer
Log.Debug("Deserialize message");
using StreamReader input = new(context.Request.InputStream);
var contentJson = input.ReadToEnd();
if (targetType == null)
return null;
message = serializer.Deserialize(contentJson, targetType);
if (targetType != null)
message = serializer.Deserialize(contentJson, targetType);
}
catch (OutOfMemoryException)
{