Ocelot
Ocelot copied to clipboard
Logging bug in `HttpRequesterMiddleware`
BadRequest
should be logged as debug!
@masoud-bahrami Now Masoud, please explain what did you do in this PR? I see a small refactoring here... Nothing more!
Have you read our development process docs?
@raman-m In the CreateLogBasedOnResponse method due to if (response.Data?.StatusCode <= HttpStatusCode.BadRequest)
logic, BadRequest will be logged as Information
.
As you can see, In the next branch of if, else if (response.Data?.StatusCode >= HttpStatusCode.BadRequest)
again HttpStatusCode.BadRequest is checked.
It's like
If (a <= 400) do something else If (a >= 400) do something else
@masoud-bahrami
BadRequest
should be logged as debug!
Did you mean as warning? 😉 to be logged by LogWarning
method?
OK... Now I see!..
It is a small comparison typo <=
in the code but resulting to real bug...
@ggnaegi Tom is the author of this tiny ugly bug in commit https://github.com/ThreeMammals/Ocelot/commit/ebe662abe6b04ab35a13f3936440aa6904a5fa4d 🤣 added in version 14.0.3 Please review! I will ask unit & acceptance tests...