Uh oh!
There was an error while loading. Please reload this page.
Missing overrides in LoggingHttpMessageHandler and LoggingScopeHttpMessageHandler - #85143
Conversation
ghost
commented
Apr 21, 2023
Tagging subscribers to this area: @dotnet/ncl Issue Detailsadd missing overrides in LoggingHttpMessageHandler and LoggingScopeHttpMessageHandler (#85104)
|
mphelt
commented
Apr 21, 2023
@dotnet-policy-service agree |
Uh oh!
There was an error while loading. Please reload this page.
CarnaViire
commented
Apr 25, 2023
@mphelt thanks for your contribution! |
I've added them, but I didn't thought of it initially, as none of the base classes has those conditions - how are they different? @Wraith2 |
| var shouldRedactHeaderValue = _options?.ShouldRedactHeaderValue ?? _shouldNotRedactHeaderValue; | ||
| // Not using a scope here because we always expect this to be at the end of the pipeline, thus there's | ||
| // not really anything to surround. | ||
| Log.RequestStart(_logger, request, shouldRedactHeaderValue); | ||
| var stopwatch = ValueStopwatch.StartNew(); | ||
| var response = base.Send(request, cancellationToken); | ||
| Log.RequestEnd(_logger, response, stopwatch.GetElapsedTime(), shouldRedactHeaderValue); | ||
| return response; |
There was a problem hiding this comment.
Can we deduplicate this logic between Send and SendAsync (same for LoggingScopeHttpMessageHandler)?
E.g. by extracting it to a helper method
privateasyncTask<HttpResponseMessage>SendAsyncCore(HttpRequestMessagerequest,boolasync,CancellationTokencancellationToken)
MihaZupan
left a comment
There was a problem hiding this comment.
Just a few comments regarding the code style used in this repo, otherwise looks good, thanks.
Unfortunately I had to add #if NET5_0_OR_GREATER directives inside useAsync ? ... : ... - is there a cleaner way to do that?
I think it's okay as-is.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
CarnaViire
commented
Apr 28, 2023
It's because previously only .NET Standard 2.0 API surface was used, which includes only async send: https://learn.microsoft.com/en-us/dotnet/api/system.net.http.delegatinghandler.sendasync?view=netstandard-2.0 -- because Microsoft.Extensions.Http is compiled for .NET Standard 2.0.
This would be adding the helper method to the public surface, which should go through API review process: https://github.com/dotnet/runtime/blob/main/docs/project/api-review-process.md |
mphelt
commented
May 4, 2023
@CarnaViire, thank you for explanation. Is there any way to re-run those failing checks? They seem to have failed for reasons not connected to this particular PR. |
CarnaViire
commented
May 4, 2023
CarnaViire
commented
May 4, 2023
Test failure is unrelated #85772 |
add missing overrides in LoggingHttpMessageHandler and LoggingScopeHttpMessageHandler
Fixes#85104