flavors / django-graphiql-debug-toolbar

Django Debug Toolbar for GraphiQL IDE and Graphene
https://pypi.python.org/pypi/django-graphiql-debug-toolbar
MIT License
72 stars 23 forks source link

Only Enable Toolbar for GraphiQL enabled views #14

Closed nanorepublica closed 3 years ago

nanorepublica commented 4 years ago

In a client project we are making use of GraphQL batching which bundles several graphql queries into one request. This results in the top level JSON body data structure being a list. This causes an exception when using that URL with this middleware enabled.

This change checks that GraphiQL is enabled before adding in the debugToolbar content.

Please let me know if you would like any more changes or tests added.

mongkok commented 3 years ago

Thanks for this PR @nanorepublica, this package should support for batch queries.

We need to check view_func.view_initkwargs instead of view_func.view_class.graphiql.