You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GraphQLPostInvocationInputParser uses request.getReader().lines().collect(joining()) to read the query string from the request. This effectively removes all line breaks from the request body.
But the query might have used these line breaks as token separator, therefore the resulting query may become invalid.
Example: Given a request body of
{
hero {
name
weight
} }
this will result in a query string {hero {nameweight}} and fail since there is no such attribute.
I would suggest to use request.getReader().lines().collect(joining(" ")) to read the request body, therefore replacing line breaks with a space.
The text was updated successfully, but these errors were encountered:
Good catch. Apparently nobody ever encountered this since most people apply proper indentation in the GraphQL queries which causes nobody to actually run into this bug in reality. I've added a fix as proposed.
GraphQLPostInvocationInputParser
usesrequest.getReader().lines().collect(joining())
to read the query string from the request. This effectively removes all line breaks from the request body.But the query might have used these line breaks as token separator, therefore the resulting query may become invalid.
Example: Given a request body of
this will result in a query string
{hero {nameweight}}
and fail since there is no such attribute.I would suggest to use
request.getReader().lines().collect(joining(" "))
to read the request body, therefore replacing line breaks with a space.The text was updated successfully, but these errors were encountered: