File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
debug_toolbar/panels/history Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ def get_headers(self, request):
24
24
observe_request = self .toolbar .get_observe_request ()
25
25
store_id = getattr (self .toolbar , "store_id" )
26
26
if store_id and observe_request (request ):
27
- headers ["DJDT-STORE-ID " ] = store_id
27
+ headers ["djdt-store-id " ] = store_id
28
28
return headers
29
29
30
30
@property
Original file line number Diff line number Diff line change @@ -99,6 +99,20 @@ def test_history_sidebar_invalid(self):
99
99
response = self .client .get (reverse ("djdt:history_sidebar" ))
100
100
self .assertEqual (response .status_code , 400 )
101
101
102
+ def test_history_headers (self ):
103
+ """Validate the headers injected from the history panel."""
104
+ response = self .client .get ("/json_view/" )
105
+ store_id = list (DebugToolbar ._store )[0 ]
106
+ self .assertEqual (response .headers ["djdt-store-id" ], store_id )
107
+
108
+ @override_settings (
109
+ DEBUG_TOOLBAR_CONFIG = {"OBSERVE_REQUEST_CALLBACK" : lambda request : False }
110
+ )
111
+ def test_history_headers_unobserved (self ):
112
+ """Validate the headers aren't injected from the history panel."""
113
+ response = self .client .get ("/json_view/" )
114
+ self .assertNotIn ("djdt-store-id" , response .headers )
115
+
102
116
def test_history_sidebar (self ):
103
117
"""Validate the history sidebar view."""
104
118
self .client .get ("/json_view/" )
You can’t perform that action at this time.
0 commit comments