mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-17 14:18:00 +00:00
Added comment about disposing the response object
This commit is contained in:
1 file changed
+5
@@ -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)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user