mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-02-11 15:49:06 +00:00
Added comment about disposing the response object
This commit is contained in:
parent
7dcf7a1571
commit
54264345d9
@ -103,9 +103,14 @@ public abstract class BaseProvider : IProvider, ISecretId
|
|||||||
{
|
{
|
||||||
using var request = await requestBuilder();
|
using var request = await requestBuilder();
|
||||||
|
|
||||||
|
//
|
||||||
// Send the request with the ResponseHeadersRead option.
|
// Send the request with the ResponseHeadersRead option.
|
||||||
// This allows us to read the stream as soon as the headers are received.
|
// This allows us to read the stream as soon as the headers are received.
|
||||||
// This is important because we want to stream the responses.
|
// This is important because we want to stream the responses.
|
||||||
|
//
|
||||||
|
// Please notice: We do not dispose the response here. The caller is responsible
|
||||||
|
// for disposing the response object. This is important because the response
|
||||||
|
// object is used to read the stream.
|
||||||
var nextResponse = await this.httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, token);
|
var nextResponse = await this.httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, token);
|
||||||
if (nextResponse.IsSuccessStatusCode)
|
if (nextResponse.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user