From ea10c33c0a72096eecf31514e2beb939efe39f5c Mon Sep 17 00:00:00 2001 From: "radoslaw.kowalski" Date: Tue, 4 Aug 2020 18:00:04 +0200 Subject: [PATCH] Inject GraphiQL header setting to graphiql.html template --- graphene_django/templates/graphene/graphiql.html | 3 +++ graphene_django/views.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/graphene_django/templates/graphene/graphiql.html b/graphene_django/templates/graphene/graphiql.html index abc4b52..8e71a69 100644 --- a/graphene_django/templates/graphene/graphiql.html +++ b/graphene_django/templates/graphene/graphiql.html @@ -45,6 +45,9 @@ add "&raw" to the end of the URL within a browser. {% if subscription_path %} subscriptionPath: "{{subscription_path}}", {% endif %} + {% if header_editor_enabled %} + graphiqlHeaderEditorEnabled: "{{ graphiql_header_editor_enabled}}", + {% endif %} }; diff --git a/graphene_django/views.py b/graphene_django/views.py index 59084e8..5ee0297 100644 --- a/graphene_django/views.py +++ b/graphene_django/views.py @@ -167,6 +167,8 @@ class GraphQLView(View): subscriptions_transport_ws_sri=self.subscriptions_transport_ws_sri, # The SUBSCRIPTION_PATH setting. subscription_path=self.subscription_path, + # GraphiQL headers tab, + graphiql_header_editor_enabled=graphene_settings.GRAPHIQL_HEADER_EDITOR_ENABLED, ) if self.batch: