Skip to content

Commit 9120804

Browse files
authored
ReadFromJsonAsync
1 parent e7456ff commit 9120804

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/ServiceControl.Audit.Persistence.RavenDB/LicenseStatusCheck.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ namespace ServiceControl.Audit.Persistence.RavenDB;
22

33
using System;
44
using System.Net.Http;
5+
using System.Net.Http.Json;
56
using System.Text.Json;
67
using System.Threading;
78
using System.Threading.Tasks;
@@ -18,8 +19,7 @@ public static async Task WaitForLicenseOrThrow(DatabaseConfiguration configurati
1819
while (!licenseCorrectlySetup)
1920
{
2021
var httpResponse = await client.GetAsync("license/status", cancellationToken);
21-
var responseJsonString = await httpResponse.Content.ReadAsStringAsync(cancellationToken);
22-
var licenseStatus = JsonSerializer.Deserialize<LicenseStatusFragment>(responseJsonString);
22+
var licenseStatus = await httpResponse.Content.ReadFromJsonAsync<LicenseStatusFragment>
2323
if (licenseStatus.Expired)
2424
{
2525
throw new NotSupportedException("The current RavenDB license is expired. Please, contact support");

src/ServiceControl.Persistence.RavenDB/LicenseStatusCheck.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ namespace ServiceControl.Persistence.RavenDB;
22

33
using System;
44
using System.Net.Http;
5+
using System.Net.Http.Json;
56
using System.Text.Json;
67
using System.Threading;
78
using System.Threading.Tasks;
@@ -18,8 +19,7 @@ public static async Task WaitForLicenseOrThrow(RavenPersisterSettings configurat
1819
while (!licenseCorrectlySetup)
1920
{
2021
var httpResponse = await client.GetAsync("license/status", cancellationToken);
21-
var responseJsonString = await httpResponse.Content.ReadAsStringAsync(cancellationToken);
22-
var licenseStatus = JsonSerializer.Deserialize<LicenseStatusFragment>(responseJsonString);
22+
var licenseStatus = await httpResponse.Content.ReadFromJsonAsync<LicenseStatusFragment>
2323
if (licenseStatus.Expired)
2424
{
2525
throw new NotSupportedException("The current RavenDB license is expired. Please, contact support");

0 commit comments

Comments
 (0)