Skip to content

Commit

Permalink
Remove unused show_graphiql kwarg
Browse files Browse the repository at this point in the history
  • Loading branch information
danthewildcat committed Aug 3, 2023
1 parent 314c68d commit 33b3426
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions graphene_django/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def dispatch(self, request, *args, **kwargs):
or 200
)
else:
result, status_code = self.get_response(request, data, show_graphiql)
result, status_code = self.get_response(request, data)

return HttpResponse(
status=status_code, content=result, content_type="application/json"
Expand All @@ -200,11 +200,11 @@ def dispatch(self, request, *args, **kwargs):
)
return response

def get_response(self, request, data, show_graphiql=False):
def get_response(self, request, data):
query, variables, operation_name, id = self.get_graphql_params(request, data)

execution_result = self.execute_graphql_request(
request, data, query, variables, operation_name, show_graphiql
request, data, query, variables, operation_name
)

if getattr(request, MUTATION_ERRORS_FLAG, False) is True:
Expand All @@ -231,7 +231,7 @@ def get_response(self, request, data, show_graphiql=False):
response["id"] = id
response["status"] = status_code

result = self.json_encode(request, response, pretty=show_graphiql)
result = self.json_encode(request, response)
else:
result = None

Expand Down Expand Up @@ -286,12 +286,8 @@ def parse_body(self, request):

return {}

def execute_graphql_request(
self, request, data, query, variables, operation_name, show_graphiql=False
):
def execute_graphql_request(self, request, data, query, variables, operation_name):
if not query:
if show_graphiql:
return None
raise HttpError(HttpResponseBadRequest("Must provide query string."))

try:
Expand Down Expand Up @@ -324,14 +320,12 @@ def execute_graphql_request(
request.method.lower() == "get"
and operation_ast.operation != OperationType.QUERY
):
if show_graphiql:
return None

raise HttpError(
HttpResponseNotAllowed(
["POST"],
"Can only perform a {} operation from a POST request.".format(
operation_ast.operation.value
(
f"Can only perform a {operation_ast.operation.value} operation "
"from a POST request."
),
)
)
Expand Down

0 comments on commit 33b3426

Please sign in to comment.