Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions graphene_django/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import inspect
import json
import re
from http import HTTPStatus

from django.db import connection, transaction
from django.http import HttpResponse, HttpResponseNotAllowed
Expand Down Expand Up @@ -195,7 +196,7 @@ def dispatch(self, request, *args, **kwargs):
status_code = (
responses
and max(responses, key=lambda response: response[1])[1]
or 200
or HTTPStatus.OK
)
else:
result, status_code = self.get_response(request, data, show_graphiql)
Expand All @@ -222,7 +223,7 @@ def get_response(self, request, data, show_graphiql=False):
if getattr(request, MUTATION_ERRORS_FLAG, False) is True:
set_rollback()

status_code = 200
status_code = HTTPStatus.OK
if execution_result:
response = {}

Expand All @@ -235,7 +236,7 @@ def get_response(self, request, data, show_graphiql=False):
if execution_result.errors and any(
not getattr(e, "path", None) for e in execution_result.errors
):
status_code = 400
status_code = HTTPStatus.BAD_REQUEST
else:
response["data"] = execution_result.data

Expand Down