未验证 提交 f83708c4 编写于 作者: W Wouter Gerarts 提交者: GitHub

Fix non-query compound requests #477

Use the first request's type to match all others against, as the previous method would only update the type after the check was being performed
上级 614da61f
......@@ -30,7 +30,7 @@ public class GraphQLRequestSerializer {
if (graphQLRequests.getRequests().isEmpty()) {
throw new IllegalArgumentException("At least one GraphQL request should be supplied");
}
GraphQLOperation operation = GraphQLOperation.QUERY;
GraphQLOperation operation = graphQLRequests.getRequests().get(0).getRequest().getOperationType();
StringBuilder queryBuilder = new StringBuilder();
for (GraphQLRequest request : graphQLRequests.getRequests()) {
if (request == null || request.getRequest() == null) {
......@@ -40,7 +40,6 @@ public class GraphQLRequestSerializer {
throw new IllegalArgumentException("Only operations of the same type (query/mutation/subscription) can be executed at once");
}
queryBuilder.append(buildQuery(request)).append(" ");
operation = request.getRequest().getOperationType();
}
return jsonQuery(operationWrapper(queryBuilder.toString(), operation));
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册