Arjan van Wieringen
11/02/2024, 5:52 PM<http://kotlinx.io|kotlinx.io>
library in Ktor 3, but having this issue:
call.respondSource(
source = asset.output.source, // <--- this is a Source
contentType = asset.output.contentType
)
This returns an EMPTY response.
call.respondBytes(
bytes = asset.output.source.readByteArray(),
contentType = asset.output.contentType
)
This doesn't. This hardly makes sense to me.
When I set a breakpoint in the first example before the respondSource and run the following expression: asset.output.source.readText()
I ge the full text (once, of course).Arjan van Wieringen
11/03/2024, 7:43 AMBruce Hamilton
11/04/2024, 9:39 AMrespondSource
relies on Source.transferFrom
which expects the input to be fully buffered into memory. I'm not sure if this was a mistake in Ktor's use of kotlinx-io or an issue in kotlinx-io itself. I added a workaround in the ticket using Buffer
, which is not ideal, but we ought to fix the problem for the next patch release.Arjan van Wieringen
11/04/2024, 9:47 AMBruce Hamilton
11/04/2024, 9:49 AMArjan van Wieringen
11/04/2024, 12:19 PMtestApplication
is completely different Engine than Netty ofcourse.