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):
2424 observe_request = self .toolbar .get_observe_request ()
2525 store_id = getattr (self .toolbar , "store_id" )
2626 if store_id and observe_request (request ):
27- headers ["DJDT-STORE-ID " ] = store_id
27+ headers ["djdt-store-id " ] = store_id
2828 return headers
2929
3030 @property
Original file line number Diff line number Diff line change @@ -99,6 +99,20 @@ def test_history_sidebar_invalid(self):
9999 response = self .client .get (reverse ("djdt:history_sidebar" ))
100100 self .assertEqual (response .status_code , 400 )
101101
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+
102116 def test_history_sidebar (self ):
103117 """Validate the history sidebar view."""
104118 self .client .get ("/json_view/" )
You can’t perform that action at this time.
0 commit comments