HttpClientBuilderExtensions.RedactLoggedHeaders Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
RedactLoggedHeaders(IHttpClientBuilder, IEnumerable<String>) |
Sets the collection of HTTP headers names for which values should be redacted before logging. |
RedactLoggedHeaders(IHttpClientBuilder, Func<String,Boolean>) |
Sets the Func<T,TResult> which determines whether to redact the HTTP header value given its corresponding header name before logging. |
Sets the collection of HTTP headers names for which values should be redacted before logging.
public:
[System::Runtime::CompilerServices::Extension]
static Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ RedactLoggedHeaders(Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ builder, System::Collections::Generic::IEnumerable<System::String ^> ^ redactedLoggedHeaderNames);
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder RedactLoggedHeaders(this Microsoft.Extensions.DependencyInjection.IHttpClientBuilder builder, System.Collections.Generic.IEnumerable<string> redactedLoggedHeaderNames);
static member RedactLoggedHeaders : Microsoft.Extensions.DependencyInjection.IHttpClientBuilder * seq<string> -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder
<Extension()>
Public Function RedactLoggedHeaders (builder As IHttpClientBuilder, redactedLoggedHeaderNames As IEnumerable(Of String)) As IHttpClientBuilder
Parameters
- builder
- IHttpClientBuilder
The IHttpClientBuilder.
- redactedLoggedHeaderNames
- IEnumerable<String>
The collection of HTTP headers names for which values should be redacted before logging.
Returns
The IHttpClientBuilder.
Applies to
.NET 9 (package-provided) and other versions
Product | Versions |
---|---|
.NET | 8 (package-provided), 9 (package-provided) |
.NET Framework | 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided) |
Sets the Func<T,TResult> which determines whether to redact the HTTP header value given its corresponding header name before logging.
public:
[System::Runtime::CompilerServices::Extension]
static Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ RedactLoggedHeaders(Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ builder, Func<System::String ^, bool> ^ shouldRedactHeaderValue);
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder RedactLoggedHeaders(this Microsoft.Extensions.DependencyInjection.IHttpClientBuilder builder, Func<string,bool> shouldRedactHeaderValue);
static member RedactLoggedHeaders : Microsoft.Extensions.DependencyInjection.IHttpClientBuilder * Func<string, bool> -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder
<Extension()>
Public Function RedactLoggedHeaders (builder As IHttpClientBuilder, shouldRedactHeaderValue As Func(Of String, Boolean)) As IHttpClientBuilder
Parameters
- builder
- IHttpClientBuilder
The IHttpClientBuilder.
The Func<T,TResult> which determines whether to redact the HTTP header value given its corresponding header name before logging.
Returns
The IHttpClientBuilder.
Remarks
The provided shouldRedactHeaderValue
predicate will be evaluated for each header name when logging. If the predicate returns true
then the header value will be replaced with a marker value *
in logs; otherwise the header value will be logged.
Applies to
.NET 9 (package-provided) and other versions
Product | Versions |
---|---|
.NET | 8 (package-provided), 9 (package-provided) |
.NET Framework | 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided) |
.NET feedback
.NET is an open source project. Select a link to provide feedback: