diff --git a/clients/dotnet/WebClient/MemoryWebClient.cs b/clients/dotnet/WebClient/MemoryWebClient.cs index f767881fd..46baf4158 100644 --- a/clients/dotnet/WebClient/MemoryWebClient.cs +++ b/clients/dotnet/WebClient/MemoryWebClient.cs @@ -368,7 +368,13 @@ public async IAsyncEnumerable AskStreamingAsync( using StringContent content = new(JsonSerializer.Serialize(request), Encoding.UTF8, "application/json"); var url = Constants.HttpAskEndpoint.CleanUrlPath(); - HttpResponseMessage response = await this._client.PostAsync(url, content, cancellationToken).ConfigureAwait(false); + using var requestMessage = new HttpRequestMessage(HttpMethod.Post, url); + requestMessage.Content = content; + HttpCompletionOption completionOption = useStreaming + ? HttpCompletionOption.ResponseHeadersRead + : HttpCompletionOption.ResponseContentRead; + + HttpResponseMessage response = await this._client.SendAsync(requestMessage, completionOption, cancellationToken).ConfigureAwait(false); response.EnsureSuccessStatusCode(); if (useStreaming)