Inject GraphiQL header setting to graphiql.html template

This commit is contained in:
radoslaw.kowalski 2020-08-04 18:00:04 +02:00
parent ca115f5381
commit ea10c33c0a
2 changed files with 5 additions and 0 deletions

View File

@ -45,6 +45,9 @@ add "&raw" to the end of the URL within a browser.
{% if subscription_path %} {% if subscription_path %}
subscriptionPath: "{{subscription_path}}", subscriptionPath: "{{subscription_path}}",
{% endif %} {% endif %}
{% if header_editor_enabled %}
graphiqlHeaderEditorEnabled: "{{ graphiql_header_editor_enabled}}",
{% endif %}
}; };
</script> </script>
<script src="{% static 'graphene_django/graphiql.js' %}"></script> <script src="{% static 'graphene_django/graphiql.js' %}"></script>

View File

@ -167,6 +167,8 @@ class GraphQLView(View):
subscriptions_transport_ws_sri=self.subscriptions_transport_ws_sri, subscriptions_transport_ws_sri=self.subscriptions_transport_ws_sri,
# The SUBSCRIPTION_PATH setting. # The SUBSCRIPTION_PATH setting.
subscription_path=self.subscription_path, subscription_path=self.subscription_path,
# GraphiQL headers tab,
graphiql_header_editor_enabled=graphene_settings.GRAPHIQL_HEADER_EDITOR_ENABLED,
) )
if self.batch: if self.batch: