Skip to content

Error on Ktor 2.0.x #200

@jklepek

Description

@jklepek

Hey,
I've tried to implement KGraphQL with Ktor version 2.0.2, but for the life of me, couldn't get it to work, I would always get JSON parse error unexpected end of file. Inspecting this, in the end I found that the issue is with
receiveStream() call in receiveTextWithCorrectEncoding() method. I would get Acquiring blocking primitives on this dispatcher is not allowed. Consider using async channel or doing withContext(Dispatchers.IO) { call.receive<InputStream>().use { ... } } instead.
So, when I tried the suggested, it worked.
I couldn't make a PR so, here's a suggestion
return withContext(Dispatchers.IO) { receiveStream().bufferedReader(charset = suitableCharset).readText() }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions