mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-02-05 06:00:37 +03:00
Merge pull request #123 from HorizonXP/fix-batch-response-format
Remove payload key from response and stick to original format.
This commit is contained in:
commit
1139507a14
|
@ -178,7 +178,7 @@ def test_batch_allows_post_with_json_encoding(client):
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
assert response_json(response) == [{
|
assert response_json(response) == [{
|
||||||
'id': 1,
|
'id': 1,
|
||||||
'payload': { 'data': {'test': "Hello World"} },
|
'data': {'test': "Hello World"},
|
||||||
'status': 200,
|
'status': 200,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
@ -233,7 +233,7 @@ def test_batch_supports_post_json_query_with_string_variables(client):
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
assert response_json(response) == [{
|
assert response_json(response) == [{
|
||||||
'id': 1,
|
'id': 1,
|
||||||
'payload': { 'data': {'test': "Hello Dolly"} },
|
'data': {'test': "Hello Dolly"},
|
||||||
'status': 200,
|
'status': 200,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ def test_batch_supports_post_json_query_with_json_variables(client):
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
assert response_json(response) == [{
|
assert response_json(response) == [{
|
||||||
'id': 1,
|
'id': 1,
|
||||||
'payload': { 'data': {'test': "Hello Dolly"} },
|
'data': {'test': "Hello Dolly"},
|
||||||
'status': 200,
|
'status': 200,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
@ -356,11 +356,9 @@ def test_batch_allows_post_with_operation_name(client):
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
assert response_json(response) == [{
|
assert response_json(response) == [{
|
||||||
'id': 1,
|
'id': 1,
|
||||||
'payload': {
|
'data': {
|
||||||
'data': {
|
'test': 'Hello World',
|
||||||
'test': 'Hello World',
|
'shared': 'Hello Everyone'
|
||||||
'shared': 'Hello Everyone'
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
'status': 200,
|
'status': 200,
|
||||||
}]
|
}]
|
||||||
|
|
|
@ -160,11 +160,8 @@ class GraphQLView(View):
|
||||||
response['data'] = execution_result.data
|
response['data'] = execution_result.data
|
||||||
|
|
||||||
if self.batch:
|
if self.batch:
|
||||||
response = {
|
response['id'] = id
|
||||||
'id': id,
|
response['status'] = status_code
|
||||||
'payload': response,
|
|
||||||
'status': status_code,
|
|
||||||
}
|
|
||||||
|
|
||||||
result = self.json_encode(request, response, pretty=show_graphiql)
|
result = self.json_encode(request, response, pretty=show_graphiql)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user