-
Notifications
You must be signed in to change notification settings - Fork 45
Add function to pretty print HttpRequest #3636
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
base: master
Are you sure you want to change the base?
Conversation
Test results 27 files 27 suites 45m 14s ⏱️ Results for commit 7256556. ♻️ This comment has been updated with latest results. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3636 +/- ##
==========================================
+ Coverage 62.68% 62.82% +0.14%
==========================================
Files 611 611
Lines 45102 45138 +36
Branches 43 43
==========================================
+ Hits 28270 28357 +87
+ Misses 16822 16771 -51
Partials 10 10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Make it easy to dump the contents of a view's HttpRequest to a logger.
python/nav/django/utils.py
Outdated
| raise FieldDoesNotExist | ||
|
|
||
|
|
||
| def pp_request(request: HttpRequest, function, *attributes) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this adds some very nice functionality, this name sucks, IMNSHO.
I take it pp is meant to convey the concept of pretty-print (but it sounds awfully childish when pronounced). Since it doesn't actually "print" anything, at best this would be cognate with the function pprint.pformat(), so how about pformat_request() instead?
|



Scope and purpose
Make it easy to dump the contents of a view's HttpRequest to a logger.
This is useful for debugging http headers both in development and production, as the headers sent to Django are cleaned up and renamed before being made available to a view. Some webservers and proxies also tweak the headers.
Useful for debugging REMOTE_USER problems...
Contributor Checklist
Every pull request should have this checklist filled out, no matter how small it is.
More information about contributing to NAV can be found in the
Hacker's guide to NAV.
<major>.<minor>.x). For a new feature or other additions, it should be based onmaster.