about summary refs log tree commit diff
path: root/LibMatrix/Extensions/HttpClientExtensions.cs
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-10-11 15:18:02 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-10-11 15:18:02 +0200
commitb475ba5cf146114a820b464e901b5129b2abfe84 (patch)
treea7855482df8f6cb602834bfbac256b3443d0fae5 /LibMatrix/Extensions/HttpClientExtensions.cs
parentSet timeout for command listener (diff)
downloadLibMatrix-b475ba5cf146114a820b464e901b5129b2abfe84.tar.xz
Fix bug with event sending, make initial sync detection deterministic
Diffstat (limited to 'LibMatrix/Extensions/HttpClientExtensions.cs')
-rw-r--r--LibMatrix/Extensions/HttpClientExtensions.cs4
1 files changed, 3 insertions, 1 deletions
diff --git a/LibMatrix/Extensions/HttpClientExtensions.cs b/LibMatrix/Extensions/HttpClientExtensions.cs
index 2fe99b6..6f1eab6 100644
--- a/LibMatrix/Extensions/HttpClientExtensions.cs
+++ b/LibMatrix/Extensions/HttpClientExtensions.cs
@@ -4,6 +4,7 @@ using System.Net.Http.Headers;
 using System.Reflection;
 using System.Text;
 using System.Text.Json;
+using System.Text.Json.Serialization;
 using ArcaneLibs.Extensions;
 
 namespace LibMatrix.Extensions;
@@ -93,7 +94,8 @@ public class MatrixHttpClient : HttpClient {
         CancellationToken cancellationToken = default) {
         var request = new HttpRequestMessage(HttpMethod.Put, requestUri);
         request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
-        request.Content = new StringContent(JsonSerializer.Serialize(value, value.GetType()), Encoding.UTF8, "application/json");
+        request.Content = new StringContent(JsonSerializer.Serialize(value, value.GetType(), options ?? new() { DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull }),
+            Encoding.UTF8, "application/json");
         return await SendAsync(request, cancellationToken);
     }
 }