Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty HTTP requests get logged after commit 9bfe9c99bc524c466458f5c8cbf516e8e1f97cd2 (8/28/2020) #141

Open
martinbertolino opened this issue Jul 17, 2021 · 0 comments

Comments

@martinbertolino
Copy link
Contributor

martinbertolino commented Jul 17, 2021

We are users of this package, thank you, and we recently bumped to the latest version as part of a larger upgrade effort.

Everything still works well, however we noticed that we have a lot of log entries with and empty message, for HTTP requests with no body.

ERROR|P|2021-07-17 18:43:25,185|3698|140577588385536|31e1c60a-aad0-457b-a49c-2ac47661353f|middleware|log|b''

I did some review of the code and I noticed that as part of commit 9bfe9c9 , _log_request_body changed the test of the body from:

if request.body:

to

if self.cached_request_body is not None:

Which means that the code now logs empty request bodies.

Do you know if this change was intentional to actually log empty bodies or is it an oversight form the change to using cached_request_body rather than body?

If you agree that this was an unintended change, I'm happy to consider a fix and create a pull request for the change.

I did a small test changing the line from:

if self.cached_request_body is not None:

to

if self.cached_request_body:

And the behaviour now matches the one pre commit on 8/28/2020.

Let me know if I can help.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant