https://kotlinlang.org logo
#graphql-kotlin
Title
# graphql-kotlin
d

Dariusz Kuc

02/14/2023, 10:29 PM
re: @rocketraman
Our request parser has these comments that should be taken into account for parsing the request (ktor follows the RFCs strictly instead of just defaulting to UTF-8 when doing
receiveText
):
``` override suspend fun parseRequest(request: ApplicationRequest): GraphQLServerRequest = try {
withContext(Dispatchers.IO) {
// Ktor receiveText uses the rules for plain text, and the default encoding for plain text is ISO-8859-1:
// https://www.rfc-editor.org/rfc/rfc7231#appendix-B
// https://www.rfc-editor.org/rfc/rfc8259.html#section-8.1
// https://stackoverflow.com/a/49552784/430128
// instead -- receive the data as a stream and default to UTF-8
val reader = request.call.receiveStream().reader(request.contentCharset() ?: Charsets.UTF_8)
mapper.readValue(reader, GraphQLServerRequest::class.java)
}
} catch (e: IOException) {
throw IOException("Unable to parse GraphQL payload.", e)
}```
looks like a nice enhancement -> i'm just using
receiveText()
do you mind opening up an issue (or even better PR) to track it/fix it?
r

rocketraman

02/14/2023, 11:36 PM
d

Dariusz Kuc

02/14/2023, 11:36 PM
Thanks!
10 Views