diff options
| author | Bryan Chow | 2010-03-03 15:30:30 -0800 |
|---|---|---|
| committer | Bryan Chow | 2010-03-03 15:30:30 -0800 |
| commit | 4326cbbec13f44e6d8c757f1d07fd6100596bfb6 (patch) | |
| tree | 4bfc3ddfe7e74c420b0e5bad826b9cbd49861525 /debug_toolbar/debug/headers.py | |
| parent | edf74beb6e26ed34779dff17240d2fb4c436d451 (diff) | |
| download | django-debug-toolbar-4326cbbec13f44e6d8c757f1d07fd6100596bfb6.tar.bz2 | |
Factor headers data out of HeaderDebugPanel.
Diffstat (limited to 'debug_toolbar/debug/headers.py')
| -rw-r--r-- | debug_toolbar/debug/headers.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/debug_toolbar/debug/headers.py b/debug_toolbar/debug/headers.py new file mode 100644 index 0000000..08b5bbf --- /dev/null +++ b/debug_toolbar/debug/headers.py @@ -0,0 +1,30 @@ +class DebugHeaders(object): + + # List of headers we want to display + header_filter = ( + 'CONTENT_TYPE', + 'HTTP_ACCEPT', + 'HTTP_ACCEPT_CHARSET', + 'HTTP_ACCEPT_ENCODING', + 'HTTP_ACCEPT_LANGUAGE', + 'HTTP_CACHE_CONTROL', + 'HTTP_CONNECTION', + 'HTTP_HOST', + 'HTTP_KEEP_ALIVE', + 'HTTP_REFERER', + 'HTTP_USER_AGENT', + 'QUERY_STRING', + 'REMOTE_ADDR', + 'REMOTE_HOST', + 'REQUEST_METHOD', + 'SCRIPT_NAME', + 'SERVER_NAME', + 'SERVER_PORT', + 'SERVER_PROTOCOL', + 'SERVER_SOFTWARE', + ) + + def available_headers(self, request): + return dict( + [(k, request.META[k]) for k in self.header_filter if k in request.META] + ) |
