Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 75b1c29

Browse filesBrowse files
committed
Improved GraphiQL logic
1 parent 9e206b2 commit 75b1c29
Copy full SHA for 75b1c29

File tree

1 file changed

+7
-6
lines changed
Filter options

1 file changed

+7
-6
lines changed

‎flask_graphql/graphqlview.py

Copy file name to clipboardExpand all lines: flask_graphql/graphqlview.py
+7-6Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def dispatch_request(self):
8484
data = self.parse_body(request)
8585
is_batch = isinstance(data, list)
8686

87-
show_graphiql = not is_batch and self.graphiql and self.can_display_graphiql(data)
87+
show_graphiql = not is_batch and self.should_display_graphiql(data)
8888

8989
if not is_batch:
9090
assert isinstance(data, dict), "GraphQL params should be a dict. Received {}.".format(data)
@@ -271,12 +271,13 @@ def json_encode(data, pretty=False):
271271
separators=(',', ': ')
272272
)
273273

274-
@classmethod
275-
def can_display_graphiql(cls, data):
276-
return 'raw' not in data and cls.request_wants_html()
274+
def should_display_graphiql(self, data):
275+
if not self.graphiql or 'raw' in data:
276+
return False
277277

278-
@classmethod
279-
def request_wants_html(cls):
278+
return self.request_wants_html()
279+
280+
def request_wants_html(self):
280281
best = request.accept_mimetypes \
281282
.best_match(['application/json', 'text/html'])
282283
return best == 'text/html' and \

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.