@@ -87,9 +87,10 @@ private GraphQLInvocationInput getGraphQLInvocationInput(
8787 }
8888 });
8989
90- String query = read (inputStream );
90+ String query = read (inputStream , request . getCharacterEncoding () );
9191 if ("query" .equals (key ) && isSingleQuery (query )) {
92- GraphQLRequest graphqlRequest = buildRequestFromQuery (query , graphQLObjectMapper , parts );
92+ GraphQLRequest graphqlRequest =
93+ buildRequestFromQuery (query , graphQLObjectMapper , parts , request .getCharacterEncoding ());
9394 variablesMap .ifPresent (m -> mapMultipartVariables (graphqlRequest , m , parts ));
9495 return invocationInputFactory .create (graphqlRequest , request , response );
9596 } else if (isSingleQuery (query )) {
@@ -142,33 +143,38 @@ private void mapMultipartVariables(
142143 }
143144
144145 private GraphQLRequest buildRequestFromQuery (
145- String query , GraphQLObjectMapper graphQLObjectMapper , Map <String , List <Part >> parts )
146+ String query ,
147+ GraphQLObjectMapper graphQLObjectMapper ,
148+ Map <String , List <Part >> parts ,
149+ String charset )
146150 throws IOException {
147151 Map <String , Object > variables = null ;
148152 final Optional <Part > variablesItem = getPart (parts , "variables" );
149153 if (variablesItem .isPresent ()) {
150154 variables =
151- graphQLObjectMapper .deserializeVariables (read (variablesItem .get ().getInputStream ()));
155+ graphQLObjectMapper .deserializeVariables (
156+ read (variablesItem .get ().getInputStream (), charset ));
152157 }
153158
154159 Map <String , Object > extensions = null ;
155160 final Optional <Part > extensionsItem = getPart (parts , "extensions" );
156161 if (extensionsItem .isPresent ()) {
157162 extensions =
158- graphQLObjectMapper .deserializeExtensions (read (extensionsItem .get ().getInputStream ()));
163+ graphQLObjectMapper .deserializeExtensions (
164+ read (extensionsItem .get ().getInputStream (), charset ));
159165 }
160166
161167 String operationName = null ;
162168 final Optional <Part > operationNameItem = getPart (parts , "operationName" );
163169 if (operationNameItem .isPresent ()) {
164- operationName = read (operationNameItem .get ().getInputStream ()).trim ();
170+ operationName = read (operationNameItem .get ().getInputStream (), charset ).trim ();
165171 }
166172
167173 return new GraphQLRequest (query , variables , extensions , operationName );
168174 }
169175
170- private String read (InputStream inputStream ) throws IOException {
171- try (InputStreamReader streamReader = new InputStreamReader (inputStream );
176+ private String read (InputStream inputStream , String charset ) throws IOException {
177+ try (InputStreamReader streamReader = new InputStreamReader (inputStream , charset );
172178 BufferedReader reader = new BufferedReader (streamReader )) {
173179 return reader .lines ().collect (joining ());
174180 }
0 commit comments