Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Remove payload key from response and stick to original format. #123

Merged
Merged
Show file tree
Hide file tree
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
14 changes: 6 additions & 8 deletions graphene_django/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def test_batch_allows_post_with_json_encoding(client):
assert response.status_code == 200
assert response_json(response) == [{
'id': 1,
'payload': { 'data': {'test': "Hello World"} },
'data': {'test': "Hello World"},
'status': 200,
}]

Expand Down Expand Up @@ -233,7 +233,7 @@ def test_batch_supports_post_json_query_with_string_variables(client):
assert response.status_code == 200
assert response_json(response) == [{
'id': 1,
'payload': { 'data': {'test': "Hello Dolly"} },
'data': {'test': "Hello Dolly"},
'status': 200,
}]

Expand All @@ -260,7 +260,7 @@ def test_batch_supports_post_json_query_with_json_variables(client):
assert response.status_code == 200
assert response_json(response) == [{
'id': 1,
'payload': { 'data': {'test': "Hello Dolly"} },
'data': {'test': "Hello Dolly"},
'status': 200,
}]

Expand Down Expand Up @@ -356,11 +356,9 @@ def test_batch_allows_post_with_operation_name(client):
assert response.status_code == 200
assert response_json(response) == [{
'id': 1,
'payload': {
'data': {
'test': 'Hello World',
'shared': 'Hello Everyone'
}
'data': {
'test': 'Hello World',
'shared': 'Hello Everyone'
},
'status': 200,
}]
Expand Down
7 changes: 2 additions & 5 deletions graphene_django/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,8 @@ def get_response(self, request, data, show_graphiql=False):
response['data'] = execution_result.data

if self.batch:
response = {
'id': id,
'payload': response,
'status': status_code,
}
response['id'] = id
response['status'] = status_code

result = self.json_encode(request, response, pretty=show_graphiql)
else:
Expand Down