This commit is contained in:
Alexey Subbotin 2017-05-07 04:21:16 +00:00 committed by GitHub
commit 81776fc5db
2 changed files with 2 additions and 3 deletions

View File

@ -413,9 +413,8 @@ def test_supports_pretty_printing_by_request(client):
def test_handles_field_errors_caught_by_graphql(client):
response = client.get(url_string(query='{thrower}'))
assert response.status_code == 200
assert response.status_code == 400
assert response_json(response) == {
'data': None,
'errors': [{'locations': [{'column': 2, 'line': 1}], 'message': 'Throws!'}]
}

View File

@ -154,7 +154,7 @@ class GraphQLView(View):
if execution_result.errors:
response['errors'] = [self.format_error(e) for e in execution_result.errors]
if execution_result.invalid:
if execution_result.invalid or execution_result.errors:
status_code = 400
else:
response['data'] = execution_result.data