Skip to content

Commit 7e132b5

Browse files
thomhurstclaude
andauthored
fix: Buffer HTTP response content before logging to prevent stream consumption (#1731)
* docs: Add XML documentation to ICertificates interface Fixes #1530 Added comprehensive XML documentation for: - Interface summary describing certificate retrieval functionality - GetCertificateBySubject method with parameter and return docs - GetCertificateByThumbprint method with parameter and return docs - GetCertificateBySerialNumber method with parameter and return docs - GetCertificateBy method with parameter and return docs 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: Buffer HTTP response content before logging to prevent stream consumption (#1610) When logging HTTP responses, calling ReadAsStringAsync() on the response content consumes the stream, making it unreadable by subsequent code. By calling LoadIntoBufferAsync() first, we ensure the content is buffered and can be read multiple times. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent a89becf commit 7e132b5

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/ModularPipelines/Http/ResponseLoggingHttpHandler.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage
1818
{
1919
var response = await base.SendAsync(request, cancellationToken).ConfigureAwait(false);
2020

21+
// Buffer the response content so it can be read multiple times.
22+
// Without this, reading the body for logging consumes the stream,
23+
// making it unreadable by subsequent code. See issue #1610.
24+
await response.Content.LoadIntoBufferAsync().ConfigureAwait(false);
25+
2126
await _httpLogger.PrintResponse(response, _logger).ConfigureAwait(false);
2227

2328
return response;

0 commit comments

Comments
 (0)