diff --git a/Consul/Client_DeleteRequests.cs b/Consul/Client_DeleteRequests.cs index 7d8b98dce..bdabfe0cb 100644 --- a/Consul/Client_DeleteRequests.cs +++ b/Consul/Client_DeleteRequests.cs @@ -59,8 +59,13 @@ public async Task> Execute(CancellationToken ct) var response = await Client.HttpClient.SendAsync(message, ct).ConfigureAwait(false); result.StatusCode = response.StatusCode; - - ResponseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); + ResponseStream = await response.Content +#if !NET6_0_OR_GREATER + .ReadAsStreamAsync() +#else + .ReadAsStreamAsync(ct) +#endif + .ConfigureAwait(false); if (response.StatusCode != HttpStatusCode.NotFound && !response.IsSuccessStatusCode) { @@ -146,7 +151,13 @@ public async Task Execute(CancellationToken ct) result.StatusCode = response.StatusCode; - ResponseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); + ResponseStream = await response.Content +#if !NET6_0_OR_GREATER + .ReadAsStreamAsync() +#else + .ReadAsStreamAsync(ct) +#endif + .ConfigureAwait(false); if (response.StatusCode != HttpStatusCode.NotFound && !response.IsSuccessStatusCode) { @@ -246,7 +257,13 @@ public async Task Execute(CancellationToken ct) result.StatusCode = response.StatusCode; - ResponseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); + ResponseStream = await response.Content +#if !NET6_0_OR_GREATER + .ReadAsStreamAsync() +#else + .ReadAsStreamAsync(ct) +#endif + .ConfigureAwait(false); if (response.StatusCode != HttpStatusCode.NotFound && !response.IsSuccessStatusCode) { diff --git a/Consul/Client_GetRequests.cs b/Consul/Client_GetRequests.cs index 61257da06..4ba7a7315 100644 --- a/Consul/Client_GetRequests.cs +++ b/Consul/Client_GetRequests.cs @@ -77,7 +77,13 @@ public async Task> Execute(CancellationToken ct) ParseQueryHeaders(response, result); result.StatusCode = response.StatusCode; - ResponseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); + ResponseStream = await response.Content +#if !NET6_0_OR_GREATER + .ReadAsStreamAsync() +#else + .ReadAsStreamAsync(ct) +#endif + .ConfigureAwait(false); Func isSpecialStatusCode = () => @@ -131,7 +137,13 @@ public async Task> ExecuteStreaming(CancellationToken ct) ParseQueryHeaders(response, result as QueryResult); result.StatusCode = response.StatusCode; - ResponseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); + ResponseStream = await response.Content +#if !NET6_0_OR_GREATER + .ReadAsStreamAsync() +#else + .ReadAsStreamAsync(ct) +#endif + .ConfigureAwait(false); result.Response = ResponseStream; @@ -330,7 +342,13 @@ public async Task> Execute(CancellationToken ct) var response = await Client.HttpClient.SendAsync(message, ct).ConfigureAwait(false); result.StatusCode = response.StatusCode; - ResponseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); + ResponseStream = await response.Content +#if !NET6_0_OR_GREATER + .ReadAsStreamAsync() +#else + .ReadAsStreamAsync(ct) +#endif + .ConfigureAwait(false); Func isSpecialStatusCode = () => { diff --git a/Consul/Client_PostRequests.cs b/Consul/Client_PostRequests.cs index 96d37452c..81b907583 100644 --- a/Consul/Client_PostRequests.cs +++ b/Consul/Client_PostRequests.cs @@ -65,7 +65,13 @@ public async Task> Execute(CancellationToken ct) result.StatusCode = response.StatusCode; - ResponseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); + ResponseStream = await response.Content +#if !NET6_0_OR_GREATER + .ReadAsStreamAsync() +#else + .ReadAsStreamAsync(ct) +#endif + .ConfigureAwait(false); if (response.StatusCode != HttpStatusCode.NotFound && !response.IsSuccessStatusCode) { @@ -170,7 +176,13 @@ public async Task Execute(CancellationToken ct) result.StatusCode = response.StatusCode; - ResponseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); + ResponseStream = await response.Content +#if !NET6_0_OR_GREATER + .ReadAsStreamAsync() +#else + .ReadAsStreamAsync(ct) +#endif + .ConfigureAwait(false); if (response.StatusCode != HttpStatusCode.NotFound && !response.IsSuccessStatusCode) { @@ -271,7 +283,13 @@ public async Task> Execute(CancellationToken ct) result.StatusCode = response.StatusCode; - ResponseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); + ResponseStream = await response.Content +#if !NET6_0_OR_GREATER + .ReadAsStreamAsync() +#else + .ReadAsStreamAsync(ct) +#endif + .ConfigureAwait(false); if (response.StatusCode != HttpStatusCode.NotFound && !response.IsSuccessStatusCode) { @@ -361,7 +379,13 @@ public async Task> Execute(CancellationToken ct) result.StatusCode = response.StatusCode; - ResponseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); + ResponseStream = await response.Content +#if !NET6_0_OR_GREATER + .ReadAsStreamAsync() +#else + .ReadAsStreamAsync(ct) +#endif + .ConfigureAwait(false); if (response.StatusCode != HttpStatusCode.NotFound && !response.IsSuccessStatusCode) { diff --git a/Consul/Client_PutRequests.cs b/Consul/Client_PutRequests.cs index 7ec0b3915..697126fc5 100644 --- a/Consul/Client_PutRequests.cs +++ b/Consul/Client_PutRequests.cs @@ -60,7 +60,13 @@ public async Task> Execute(CancellationToken ct) result.StatusCode = response.StatusCode; - ResponseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); + ResponseStream = await response.Content +#if !NET6_0_OR_GREATER + .ReadAsStreamAsync() +#else + .ReadAsStreamAsync(ct) +#endif + .ConfigureAwait(false); if (response.StatusCode != HttpStatusCode.NotFound && !response.IsSuccessStatusCode) { @@ -145,7 +151,13 @@ public async Task Execute(CancellationToken ct) result.StatusCode = response.StatusCode; - ResponseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); + ResponseStream = await response.Content +#if !NET6_0_OR_GREATER + .ReadAsStreamAsync() +#else + .ReadAsStreamAsync(ct) +#endif + .ConfigureAwait(false); if (response.StatusCode != HttpStatusCode.NotFound && !response.IsSuccessStatusCode) { @@ -245,7 +257,13 @@ public async Task Execute(CancellationToken ct) result.StatusCode = response.StatusCode; - ResponseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); + ResponseStream = await response.Content +#if !NET6_0_OR_GREATER + .ReadAsStreamAsync() +#else + .ReadAsStreamAsync(ct) +#endif + .ConfigureAwait(false); if (response.StatusCode != HttpStatusCode.NotFound && !response.IsSuccessStatusCode) { @@ -346,7 +364,13 @@ public async Task> Execute(CancellationToken ct) result.StatusCode = response.StatusCode; - ResponseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); + ResponseStream = await response.Content +#if !NET6_0_OR_GREATER + .ReadAsStreamAsync() +#else + .ReadAsStreamAsync(ct) +#endif + .ConfigureAwait(false); if (!response.IsSuccessStatusCode && ( (response.StatusCode != HttpStatusCode.NotFound && typeof(TOut) != typeof(TxnResponse)) || diff --git a/Consul/Consul.csproj b/Consul/Consul.csproj index b6f4b1286..37b69dda8 100644 --- a/Consul/Consul.csproj +++ b/Consul/Consul.csproj @@ -1,7 +1,7 @@ - netstandard2.0;net461;netstandard2.1 + netstandard2.0;net461;net6 PlayFab,$(Authors) Copyright 2015-2018 PlayFab Inc.; $(Copyright) Consul.NET is a .NET client library for the Consul HTTP API