Skip to content

Commit 9067735

Browse files
committed
fix(#471): recognize application/graphql content-type when charset added
1 parent 4ac91fe commit 9067735

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

graphql-java-servlet/src/main/java/graphql/kickstart/servlet/AbstractGraphQLInvocationInputParser.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ boolean isSingleQuery(String query) {
1717
}
1818

1919
boolean isBatchedQuery(String query) {
20-
return query != null && !query.trim().isEmpty() && query.trim().startsWith("[");
20+
return query != null && query.trim().startsWith("[");
2121
}
2222
}

graphql-java-servlet/src/main/java/graphql/kickstart/servlet/GraphQLPostInvocationInputParser.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ class GraphQLPostInvocationInputParser extends AbstractGraphQLInvocationInputPar
2626

2727
public GraphQLInvocationInput getGraphQLInvocationInput(
2828
HttpServletRequest request, HttpServletResponse response) throws IOException {
29-
if (APPLICATION_GRAPHQL.equals(request.getContentType())) {
29+
String contentType = request.getContentType();
30+
if (contentType != null && APPLICATION_GRAPHQL.equals(contentType.split(";")[0].trim())) {
3031
String query = request.getReader().lines().collect(joining(" "));
3132
GraphQLRequest graphqlRequest = GraphQLRequest.createQueryOnlyRequest(query);
3233
return invocationInputFactory.create(graphqlRequest, request, response);

0 commit comments

Comments
 (0)