Skip to content

Commit 0466032

Browse files
perf(client): use async deserialization in HttpResponse
1 parent bb19c13 commit 0466032

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/Orb/Core/HttpResponse.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,14 @@ public async Task<T> Deserialize<T>(CancellationToken cancellationToken = defaul
2222
);
2323
try
2424
{
25-
return JsonSerializer.Deserialize<T>(
26-
await this.ReadAsStream(cts.Token).ConfigureAwait(false),
27-
ModelBase.SerializerOptions
28-
) ?? throw new OrbInvalidDataException("Response cannot be null");
25+
return await JsonSerializer
26+
.DeserializeAsync<T>(
27+
await this.ReadAsStream(cts.Token).ConfigureAwait(false),
28+
ModelBase.SerializerOptions,
29+
cts.Token
30+
)
31+
.ConfigureAwait(false)
32+
?? throw new OrbInvalidDataException("Response cannot be null");
2933
}
3034
catch (HttpRequestException e)
3135
{

0 commit comments

Comments
 (0)