support raw messages on apiclient->apiserver

This commit is contained in:
Pilzinsel64
2025-12-03 07:58:26 +01:00
parent 2bc2352cb1
commit 06f2fcaddd
4 changed files with 60 additions and 39 deletions

View File

@@ -100,7 +100,17 @@ public class ApiClient(string apiUrl) : IApiClient
Log.Debug("Create content");
if (context.Message is not null)
if (context.Message is ApiRawByteMessage messageRawBytes)
{
content = new ByteArrayContent(messageRawBytes.Data);
content.Headers.ContentType = new("application/octet-stream");
}
else if (context.Message is ApiRawStreamMessage messageRawStream)
{
content = new StreamContent(messageRawStream.Data);
content.Headers.ContentType = new("application/octet-stream");
}
else if (context.Message is not null)
content = new StringContent(context.Serializer.Serialize(context.Message)!, null, "application/json");
else
content = new StringContent(string.Empty, null, "application/json");