Thinking this may be more a ktor problem. I made a...
# graphql-kotlin
e
Thinking this may be more a ktor problem. I made a horrible work-around:
Copy code
class KtorGraphQLRequestParser(
    private val mapper: ObjectMapper
) : GraphQLRequestParser<ApplicationRequest> {
    @Suppress("BlockingMethodInNonBlockingContext")
    override suspend fun parseRequest(request: ApplicationRequest): GraphQLServerRequest = try {
        val rawRequest = request.call.receiveText()
        val encoded = rawRequest.toByteArray(Charsets.ISO_8859_1)
        val decoded = String(encoded, Charsets.UTF_8)
        mapper.readValue(decoded, GraphQLServerRequest::class.java)
    } catch (e: IOException) {
        throw IOException("Unable to parse GraphQL payload.")
    }
}
s
That is what you have to do if you want to use ISO 8859-1 content: https://github.com/FasterXML/jackson-core/issues/222
JSON does NOT allow use of ISO-8859-1 as per specification; only UTF-8, UTF-16 and UTF-32 are supported
e
the problem is that the content is in utf-8 but ktor somehow assumes it is in iso-8859-1.
s
So with your current setup is it properly decoding and sending into to the functions or do you still have issues?
e
the work-around fixes everything. I am just wondering if I failed to configure something properly
s
That sounds like a Ktor specific issue but that is how you would properly parse a custom request format. Then the schema generator should get a valid argument from that request