Closed jklepek closed 2 years ago
We have the same issue.
Alternatively, the code can be changed to following (as how ktor own receiveText() does it):
return receiveChannel().readRemaining().readText(suitableCharset)
Also having this issue. Looking forward to the new release
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 inreceiveTextWithCorrectEncoding()
method. I would getAcquiring 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 suggestionreturn withContext(Dispatchers.IO) { receiveStream().bufferedReader(charset = suitableCharset).readText() }