Skip to content

Commit

Permalink
Fix Queries Containing % (#766)
Browse files Browse the repository at this point in the history
  • Loading branch information
Syer10 authored Nov 7, 2023
1 parent 460fc23 commit 50cd0c4
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,17 @@ class JavalinGraphQLRequestParser : GraphQLRequestParser<Context> {
@Suppress("PARAMETER_NAME_CHANGED_ON_OVERRIDE", "UNCHECKED_CAST")
override suspend fun parseRequest(context: Context): GraphQLServerRequest? {
return try {
val contentType = context.contentType()
val formParam =
context.formParam("operations")
?: return context.bodyAsClass(GraphQLServerRequest::class.java)
if (
contentType?.contains("application/x-www-form-urlencoded") == true ||
contentType?.contains("multipart/form-data") == true
) {
context.formParam("operations")
?: throw IllegalArgumentException("Cannot find 'operations' body")
} else {
return context.bodyAsClass(GraphQLServerRequest::class.java)
}

val request =
context.jsonMapper().fromJsonString(
Expand Down

0 comments on commit 50cd0c4

Please sign in to comment.