From 061eccf8462c941d14e62da2067dd863620f6178 Mon Sep 17 00:00:00 2001 From: Pilzinsel64 Date: Wed, 3 Dec 2025 12:10:44 +0100 Subject: [PATCH] fix --- Pilz.Net/Api/ApiServer.cs | 11 +++++++---- Pilz.Net/Pilz.Net.csproj | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Pilz.Net/Api/ApiServer.cs b/Pilz.Net/Api/ApiServer.cs index 71df069..51b5504 100644 --- a/Pilz.Net/Api/ApiServer.cs +++ b/Pilz.Net/Api/ApiServer.cs @@ -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) { diff --git a/Pilz.Net/Pilz.Net.csproj b/Pilz.Net/Pilz.Net.csproj index 522da93..ddcc16a 100644 --- a/Pilz.Net/Pilz.Net.csproj +++ b/Pilz.Net/Pilz.Net.csproj @@ -8,7 +8,7 @@ - 2.11.3 + 2.11.4