@@ -57,26 +57,25 @@ def process_view(self, request, view_func, *args):
5757 return super ().process_view (request , view_func , * args )
5858
5959 def process_response (self , request , response ):
60- is_query = request .is_graphql_view and \
61- request .content_type == 'application/json'
62-
63- toolbar = self .__class__ .debug_toolbars .get (
60+ toolbar = type (self ).debug_toolbars .get (
6461 threading .current_thread ().ident , None )
6562
6663 response = super ().process_response (request , response )
6764 content_type = response .get ('Content-Type' , '' ).split (';' )[0 ]
65+ html_type = content_type in middleware ._HTML_TYPES
6866
6967 if (response .status_code == 200 and
7068 toolbar is not None and
7169 request .is_graphql_view and
72- not is_query ):
70+ html_type ):
7371
74- response . write ( render_to_string (
75- 'graphiql_debug_toolbar/base.html' ) )
72+ template = render_to_string ('graphiql_debug_toolbar/base.html' )
73+ response . write ( template )
7674 set_content_length (response )
7775
78- if (toolbar is None or not is_query or
79- content_type in middleware ._HTML_TYPES ):
76+ if toolbar is None or html_type or not (
77+ request .is_graphql_view and
78+ request .content_type == 'application/json' ):
8079 return response
8180
8281 payload = get_payload (request , response , toolbar )
0 commit comments