From 9f8fd4346b0e9da70109c4d575e06ed6fea6ca4b Mon Sep 17 00:00:00 2001 From: "radoslaw.kowalski" Date: Thu, 6 Aug 2020 21:36:07 +0200 Subject: [PATCH] Enable headers editor in GraphiQL by default --- docs/settings.rst | 4 ++-- graphene_django/settings.py | 4 ++-- graphene_django/static/graphene_django/graphiql.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/settings.rst b/docs/settings.rst index 587e8b5..1e82e70 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -193,14 +193,14 @@ Default: ``None`` GraphiQL starting from version 1.0.0 allows setting custom headers in similar fashion to query variables. -Set to ``True`` to enable GraphiQL headers editor tab. +Set to ``False`` if you want to disable GraphiQL headers editor tab for some reason. This setting is passed to ``headerEditorEnabled`` GraphiQL options, for details refer to GraphiQLDocs_. .. _GraphiQLDocs: https://github.com/graphql/graphiql/tree/main/packages/graphiql#options -Default: ``False`` +Default: ``True`` .. code:: python diff --git a/graphene_django/settings.py b/graphene_django/settings.py index 4116ee1..71b791c 100644 --- a/graphene_django/settings.py +++ b/graphene_django/settings.py @@ -41,10 +41,10 @@ DEFAULTS = { "DJANGO_CHOICE_FIELD_ENUM_CUSTOM_NAME": None, # Use a separate path for handling subscriptions. "SUBSCRIPTION_PATH": None, - # Set to True to enable GraphiQL headers editor tab + # By default GraphiQL headers editor tab is enabled, set to False to hide it # This sets headerEditorEnabled GraphiQL option, for details go to # https://github.com/graphql/graphiql/tree/main/packages/graphiql#options - "GRAPHIQL_HEADER_EDITOR_ENABLED": False, + "GRAPHIQL_HEADER_EDITOR_ENABLED": True, } if settings.DEBUG: diff --git a/graphene_django/static/graphene_django/graphiql.js b/graphene_django/static/graphene_django/graphiql.js index 1903f80..42366a8 100644 --- a/graphene_django/static/graphene_django/graphiql.js +++ b/graphene_django/static/graphene_django/graphiql.js @@ -175,7 +175,7 @@ onEditQuery: onEditQuery, onEditVariables: onEditVariables, onEditOperationName: onEditOperationName, - headerEditorEnabled: GRAPHENE_SETTINGS.graphiqlHeaderEditorEnabled || false, + headerEditorEnabled: GRAPHENE_SETTINGS.graphiqlHeaderEditorEnabled || true, query: parameters.query, }; if (parameters.variables) {