Big Chungus
04/27/2024, 4:18 PMException in thread "main" io.ktor.utils.io.charsets.TooLongLineException: Line is longer than limit
at io.ktor.utils.io.ByteBufferChannel$readUTF8LineToUtf8Suspend$2.invoke(ByteBufferChannel.kt:2022)
at io.ktor.utils.io.ByteBufferChannel$readUTF8LineToUtf8Suspend$2.invoke(ByteBufferChannel.kt:1960)
at io.ktor.utils.io.ByteBufferChannel.read$suspendImpl(ByteBufferChannel.kt:1648)
at io.ktor.utils.io.ByteBufferChannel.read(ByteBufferChannel.kt)
at io.ktor.utils.io.ByteBufferChannel.readUTF8LineToUtf8Suspend(ByteBufferChannel.kt:1960)
at io.ktor.utils.io.ByteBufferChannel.access$readUTF8LineToUtf8Suspend(ByteBufferChannel.kt:23)
at io.ktor.utils.io.ByteBufferChannel$readUTF8LineToUtf8Suspend$1.invokeSuspend(ByteBufferChannel.kt)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
Here's my code spawning the issue
override suspend fun <T> FlowCollector<T>.emitItems(
deserializer: KSerializer<T>,
response: HttpResponse
) {
val stream = response.bodyAsChannel().toInputStream()
Json.decodeToSequence(
stream = stream,
deserializer = deserializer,
format = DecodeSequenceMode.ARRAY_WRAPPED
).forEach { emit(it) }.also { stream.close() }
}
Any clues what might be wrong (no kdocs on the exception)?Big Chungus
04/28/2024, 12:52 PMStylianos Gakis
04/28/2024, 2:50 PMBig Chungus
04/28/2024, 3:05 PMBig Chungus
04/28/2024, 5:00 PMStylianos Gakis
04/28/2024, 5:25 PMBig Chungus
04/28/2024, 5:39 PM