@@ -87,9 +87,10 @@ private GraphQLInvocationInput getGraphQLInvocationInput(
87
87
}
88
88
});
89
89
90
- String query = read (inputStream );
90
+ String query = read (inputStream , request . getCharacterEncoding () );
91
91
if ("query" .equals (key ) && isSingleQuery (query )) {
92
- GraphQLRequest graphqlRequest = buildRequestFromQuery (query , graphQLObjectMapper , parts );
92
+ GraphQLRequest graphqlRequest =
93
+ buildRequestFromQuery (query , graphQLObjectMapper , parts , request .getCharacterEncoding ());
93
94
variablesMap .ifPresent (m -> mapMultipartVariables (graphqlRequest , m , parts ));
94
95
return invocationInputFactory .create (graphqlRequest , request , response );
95
96
} else if (isSingleQuery (query )) {
@@ -142,33 +143,38 @@ private void mapMultipartVariables(
142
143
}
143
144
144
145
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 )
146
150
throws IOException {
147
151
Map <String , Object > variables = null ;
148
152
final Optional <Part > variablesItem = getPart (parts , "variables" );
149
153
if (variablesItem .isPresent ()) {
150
154
variables =
151
- graphQLObjectMapper .deserializeVariables (read (variablesItem .get ().getInputStream ()));
155
+ graphQLObjectMapper .deserializeVariables (
156
+ read (variablesItem .get ().getInputStream (), charset ));
152
157
}
153
158
154
159
Map <String , Object > extensions = null ;
155
160
final Optional <Part > extensionsItem = getPart (parts , "extensions" );
156
161
if (extensionsItem .isPresent ()) {
157
162
extensions =
158
- graphQLObjectMapper .deserializeExtensions (read (extensionsItem .get ().getInputStream ()));
163
+ graphQLObjectMapper .deserializeExtensions (
164
+ read (extensionsItem .get ().getInputStream (), charset ));
159
165
}
160
166
161
167
String operationName = null ;
162
168
final Optional <Part > operationNameItem = getPart (parts , "operationName" );
163
169
if (operationNameItem .isPresent ()) {
164
- operationName = read (operationNameItem .get ().getInputStream ()).trim ();
170
+ operationName = read (operationNameItem .get ().getInputStream (), charset ).trim ();
165
171
}
166
172
167
173
return new GraphQLRequest (query , variables , extensions , operationName );
168
174
}
169
175
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 );
172
178
BufferedReader reader = new BufferedReader (streamReader )) {
173
179
return reader .lines ().collect (joining ());
174
180
}
0 commit comments