Repository navigation
LoggingHttpMessageHandler changes HttpHeaders added with TryAddWithoutValidation when Trace logging is enabled #2300
Replies: 1 comment
|
Thanks for the careful report, and for chasing it upstream first. Your diagnosis was right, and the case you hit is not Refit. Reproduced with no Refit in the picture, capturing the bytes on the wire: This is already fixed. dotnet/runtime#132009 was accepted as a bug in Until then, the workaround is to keep logging.AddFilter("System.Net.Http.HttpClient", LogLevel.Information);The rest of your app can stay at Trace. Your report did surface a real Refit bug, though, so thank you twice. Refit's own duplicate-header check enumerates the header collection before applying each header, which triggers the same rewrite with logging switched off entirely - as soon as a method declares more than one header: That affects the Tracked as #2306. Closing this discussion since the question itself is answered - please follow that issue for the Refit-side fix. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hey, my question is about the issue I reported in dotnet/runtime#132009
It seems that Refit's logging implementation has the same problem.
The problem is that the header changes when HTTP request headers are logged.
Pretty simple to reproduce:
When the request is sent, the header value will be changed, and a single space will be added.
Accept: application/vnd.api.json;version=3.4.1- my headerAccept: application/vnd.api.json; version=3.4.1- sent headerI think the
System.Net.Http.HttpClient.Refit.Implementation...logging should not change the request header inside.Looks like it should be reported as a bug, but I'm not sure what the problem is with the Refit library. It can depend on .NET libraries in this case.
All reactions