From c9f436f08c08079aa8d4a0a2cc454af42fff4d9d Mon Sep 17 00:00:00 2001 From: thorlacius <47850061+thorlacius@users.noreply.github.com> Date: Mon, 7 Oct 2019 11:47:15 +0000 Subject: [PATCH] Refactor GraphQLView.should_display_graphiql() Clarify and shorten GraphQLView.should_display_graphiql() by writing it as a conjunction of criteria. --- flask_graphql/graphqlview.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/flask_graphql/graphqlview.py b/flask_graphql/graphqlview.py index ff257b3..763c33b 100644 --- a/flask_graphql/graphqlview.py +++ b/flask_graphql/graphqlview.py @@ -141,10 +141,7 @@ def parse_body(self): return {} def should_display_graphiql(self): - if not self.graphiql or 'raw' in request.args: - return False - - return self.request_wants_html() + return self.graphiql and 'raw' not in request.args and self.request_wants_html() def request_wants_html(self): best = request.accept_mimetypes \