Added comment about disposing the response object

This commit is contained in:
Thorsten Sommer 2025-01-29 07:20:26 +01:00
parent 7dcf7a1571
commit 54264345d9
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108

View File

@ -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)
{ {