@@ -59,18 +59,18 @@ public GraphQLInvocationInput getGraphQLInvocationInput(HttpServletRequest reque
5959 final Optional <Map <String , List <String >>> variablesMap =
6060 getPart (parts , "map" ).map (graphQLObjectMapper ::deserializeMultipartMap );
6161
62- if ("query" .equals (key )) {
63- GraphQLRequest graphqlRequest = buildRequestFromQuery (inputStream , graphQLObjectMapper , parts );
62+ String query = read (inputStream );
63+ if ("query" .equals (key ) && isSingleQuery (query )) {
64+ GraphQLRequest graphqlRequest = buildRequestFromQuery (query , graphQLObjectMapper , parts );
6465 variablesMap .ifPresent (m -> mapMultipartVariables (graphqlRequest , m , parts ));
6566 return invocationInputFactory .create (graphqlRequest , request , response );
6667 } else {
67- String body = read (inputStream );
68- if (isSingleQuery (body )) {
69- GraphQLRequest graphqlRequest = graphQLObjectMapper .readGraphQLRequest (body );
68+ if (isSingleQuery (query )) {
69+ GraphQLRequest graphqlRequest = graphQLObjectMapper .readGraphQLRequest (query );
7070 variablesMap .ifPresent (m -> mapMultipartVariables (graphqlRequest , m , parts ));
7171 return invocationInputFactory .create (graphqlRequest , request , response );
7272 } else {
73- List <GraphQLRequest > graphqlRequests = graphQLObjectMapper .readBatchedGraphQLRequest (body );
73+ List <GraphQLRequest > graphqlRequests = graphQLObjectMapper .readBatchedGraphQLRequest (query );
7474 variablesMap .ifPresent (map -> graphqlRequests .forEach (r -> mapMultipartVariables (r , map , parts )));
7575 return invocationInputFactory .create (contextSetting , graphqlRequests , request , response );
7676 }
@@ -103,11 +103,9 @@ private void mapMultipartVariables(GraphQLRequest request,
103103 });
104104 }
105105
106- private GraphQLRequest buildRequestFromQuery (InputStream inputStream ,
106+ private GraphQLRequest buildRequestFromQuery (String query ,
107107 GraphQLObjectMapper graphQLObjectMapper ,
108108 Map <String , List <Part >> parts ) throws IOException {
109- String query = read (inputStream );
110-
111109 Map <String , Object > variables = null ;
112110 final Optional <Part > variablesItem = getPart (parts , "variables" );
113111 if (variablesItem .isPresent ()) {
0 commit comments