diff --git a/src/ModularPipelines/Context/ICertificates.cs b/src/ModularPipelines/Context/ICertificates.cs index 7d1dbb4f7b..ed8decf476 100644 --- a/src/ModularPipelines/Context/ICertificates.cs +++ b/src/ModularPipelines/Context/ICertificates.cs @@ -2,13 +2,41 @@ namespace ModularPipelines.Context; +/// +/// Provides functionality for retrieving X.509 certificates from the certificate store. +/// public interface ICertificates { - public X509Certificate2? GetCertificateBySubject(StoreLocation storeLocation, string subject); + /// + /// Gets a certificate by its subject name. + /// + /// The store location to search. + /// The subject name to search for. + /// The matching certificate, or null if not found. + X509Certificate2? GetCertificateBySubject(StoreLocation storeLocation, string subject); - public X509Certificate2? GetCertificateByThumbprint(StoreLocation storeLocation, string thumbprint); + /// + /// Gets a certificate by its thumbprint. + /// + /// The store location to search. + /// The thumbprint to search for. + /// The matching certificate, or null if not found. + X509Certificate2? GetCertificateByThumbprint(StoreLocation storeLocation, string thumbprint); - public X509Certificate2? GetCertificateBySerialNumber(StoreLocation storeLocation, string serialNumber); + /// + /// Gets a certificate by its serial number. + /// + /// The store location to search. + /// The serial number to search for. + /// The matching certificate, or null if not found. + X509Certificate2? GetCertificateBySerialNumber(StoreLocation storeLocation, string serialNumber); + /// + /// Gets a certificate using a custom find type and value. + /// + /// The store location to search. + /// The type of search to perform. + /// The value to search for. + /// The matching certificate, or null if not found. X509Certificate2? GetCertificateBy(StoreLocation storeLocation, X509FindType findType, string findValue); } \ No newline at end of file diff --git a/src/ModularPipelines/Http/ResponseLoggingHttpHandler.cs b/src/ModularPipelines/Http/ResponseLoggingHttpHandler.cs index 31d0ea3bb4..431a310ae3 100644 --- a/src/ModularPipelines/Http/ResponseLoggingHttpHandler.cs +++ b/src/ModularPipelines/Http/ResponseLoggingHttpHandler.cs @@ -18,6 +18,11 @@ protected override async Task SendAsync(HttpRequestMessage { var response = await base.SendAsync(request, cancellationToken).ConfigureAwait(false); + // Buffer the response content so it can be read multiple times. + // Without this, reading the body for logging consumes the stream, + // making it unreadable by subsequent code. See issue #1610. + await response.Content.LoadIntoBufferAsync().ConfigureAwait(false); + await _httpLogger.PrintResponse(response, _logger).ConfigureAwait(false); return response;