mirror of
https://github.com/graphql-python/graphene-django.git
synced 2024-11-24 02:24:10 +03:00
Remove unused show_graphiql kwarg
This commit is contained in:
parent
314c68d2d1
commit
33b3426092
|
@ -186,7 +186,7 @@ class GraphQLView(View):
|
||||||
or 200
|
or 200
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
result, status_code = self.get_response(request, data, show_graphiql)
|
result, status_code = self.get_response(request, data)
|
||||||
|
|
||||||
return HttpResponse(
|
return HttpResponse(
|
||||||
status=status_code, content=result, content_type="application/json"
|
status=status_code, content=result, content_type="application/json"
|
||||||
|
@ -200,11 +200,11 @@ class GraphQLView(View):
|
||||||
)
|
)
|
||||||
return response
|
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)
|
query, variables, operation_name, id = self.get_graphql_params(request, data)
|
||||||
|
|
||||||
execution_result = self.execute_graphql_request(
|
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:
|
if getattr(request, MUTATION_ERRORS_FLAG, False) is True:
|
||||||
|
@ -231,7 +231,7 @@ class GraphQLView(View):
|
||||||
response["id"] = id
|
response["id"] = id
|
||||||
response["status"] = status_code
|
response["status"] = status_code
|
||||||
|
|
||||||
result = self.json_encode(request, response, pretty=show_graphiql)
|
result = self.json_encode(request, response)
|
||||||
else:
|
else:
|
||||||
result = None
|
result = None
|
||||||
|
|
||||||
|
@ -286,12 +286,8 @@ class GraphQLView(View):
|
||||||
|
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def execute_graphql_request(
|
def execute_graphql_request(self, request, data, query, variables, operation_name):
|
||||||
self, request, data, query, variables, operation_name, show_graphiql=False
|
|
||||||
):
|
|
||||||
if not query:
|
if not query:
|
||||||
if show_graphiql:
|
|
||||||
return None
|
|
||||||
raise HttpError(HttpResponseBadRequest("Must provide query string."))
|
raise HttpError(HttpResponseBadRequest("Must provide query string."))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -324,14 +320,12 @@ class GraphQLView(View):
|
||||||
request.method.lower() == "get"
|
request.method.lower() == "get"
|
||||||
and operation_ast.operation != OperationType.QUERY
|
and operation_ast.operation != OperationType.QUERY
|
||||||
):
|
):
|
||||||
if show_graphiql:
|
|
||||||
return None
|
|
||||||
|
|
||||||
raise HttpError(
|
raise HttpError(
|
||||||
HttpResponseNotAllowed(
|
HttpResponseNotAllowed(
|
||||||
["POST"],
|
["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."
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user