File tree 1 file changed +7
-1
lines changed 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -368,7 +368,13 @@ public async IAsyncEnumerable<MemoryAnswer> AskStreamingAsync(
368
368
using StringContent content = new ( JsonSerializer . Serialize ( request ) , Encoding . UTF8 , "application/json" ) ;
369
369
370
370
var url = Constants . HttpAskEndpoint . CleanUrlPath ( ) ;
371
- HttpResponseMessage response = await this . _client . PostAsync ( url , content , cancellationToken ) . ConfigureAwait ( false ) ;
371
+ using var requestMessage = new HttpRequestMessage ( HttpMethod . Post , url ) ;
372
+ requestMessage . Content = content ;
373
+ HttpCompletionOption completionOption = useStreaming
374
+ ? HttpCompletionOption . ResponseHeadersRead
375
+ : HttpCompletionOption . ResponseContentRead ;
376
+
377
+ HttpResponseMessage response = await this . _client . SendAsync ( requestMessage , completionOption , cancellationToken ) . ConfigureAwait ( false ) ;
372
378
response . EnsureSuccessStatusCode ( ) ;
373
379
374
380
if ( useStreaming )
You can’t perform that action at this time.
0 commit comments