Access to batch endpoint without parameters fixed

ValueError: max() arg is an empty sequence exception fixed
This commit is contained in:
Ivan Belokobylskiy 2017-09-27 18:46:32 +03:00 committed by GitHub
parent f35e445963
commit 459d7df42b

View File

@ -106,7 +106,7 @@ class GraphQLView(View):
if self.batch: if self.batch:
responses = [self.get_response(request, entry) for entry in data] responses = [self.get_response(request, entry) for entry in data]
result = '[{}]'.format(','.join([response[0] for response in responses])) result = '[{}]'.format(','.join([response[0] for response in responses]))
status_code = max(responses, key=lambda response: response[1])[1] status_code = responses and max(responses, key=lambda response: response[1])[1] or 200
else: else:
result, status_code = self.get_response(request, data, show_graphiql) result, status_code = self.get_response(request, data, show_graphiql)