Skip to content

Commit

Permalink
Adding in a hack to fix an issue whereby Dahomey.Json was throwing an…
Browse files Browse the repository at this point in the history
… InvalidOperationException: "Cannot skip tokens on partial JSON" exception when trying to use JsonSerializer.DeserializeAsync(stream).

Links: dahomey-technologies/Dahomey.Json#110
  • Loading branch information
kevbite committed Jun 15, 2022
1 parent 496554d commit 166c212
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Exizent.CaseManagement.Client/CaseManagementApiClient.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Globalization;
using System.Net;
using System.Net.Http.Json;
using System.Text.Json;
using Exizent.CaseManagement.Client.Models;

namespace Exizent.CaseManagement.Client;
Expand Down Expand Up @@ -31,7 +32,8 @@ public CaseManagementApiClient(HttpClient httpClient)

response.EnsureSuccessStatusCode();

return await response.Content.ReadFromJsonAsync<CaseResourceRepresentation>(DefaultJsonSerializerOptions
.Instance);
var body = await response.Content.ReadAsStringAsync();

return JsonSerializer.Deserialize<CaseResourceRepresentation>(body, DefaultJsonSerializerOptions.Instance);
}
}

0 comments on commit 166c212

Please sign in to comment.