Skip to content

Commit

Permalink
Remove unnecessary closures from Logging{Scope}HttpMessageHandler.Sen…
Browse files Browse the repository at this point in the history
…dCoreAsync (#89160)

* Avoid unnecessary closure in LoggingHttpMessageHandler.SendCoreAsync

* Remove unnecessary closure in LoggingScopeHttpMessageHandler.SendCoreAsync
  • Loading branch information
stephentoub authored Jul 19, 2023
1 parent 0321755 commit 54c0756
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ public LoggingHttpMessageHandler(ILogger logger, HttpClientFactoryOptions option
private Task<HttpResponseMessage> SendCoreAsync(HttpRequestMessage request, bool useAsync, CancellationToken cancellationToken)
{
ThrowHelper.ThrowIfNull(request);
return Core(request, cancellationToken);
return Core(request, useAsync, cancellationToken);

async Task<HttpResponseMessage> Core(HttpRequestMessage request, CancellationToken cancellationToken)
async Task<HttpResponseMessage> Core(HttpRequestMessage request, bool useAsync, CancellationToken cancellationToken)
{
Func<string, bool> shouldRedactHeaderValue = _options?.ShouldRedactHeaderValue ?? _shouldNotRedactHeaderValue;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ public LoggingScopeHttpMessageHandler(ILogger logger, HttpClientFactoryOptions o
private Task<HttpResponseMessage> SendCoreAsync(HttpRequestMessage request, bool useAsync, CancellationToken cancellationToken)
{
ThrowHelper.ThrowIfNull(request);
return Core(request, cancellationToken);
return Core(request, useAsync, cancellationToken);

async Task<HttpResponseMessage> Core(HttpRequestMessage request, CancellationToken cancellationToken)
async Task<HttpResponseMessage> Core(HttpRequestMessage request, bool useAsync, CancellationToken cancellationToken)
{
var stopwatch = ValueStopwatch.StartNew();

Expand Down

0 comments on commit 54c0756

Please sign in to comment.