mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-07-13 17:52:19 +03:00
Merge 32bb8c8255
into afec960e4d
This commit is contained in:
commit
81776fc5db
|
@ -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!'}]
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user