https://kotlinlang.org logo
#ktor
Title
# ktor
e

eenriquelopez

07/22/2022, 9:41 AM
Hi Kotliners. Does Ktor support chunk content transmission? I am using
HttpClient(CIO)
, and my client speaks with a server that delivers a chunked JSON. I have been trying to change headers, response model, etc… But it does not seem to help. I am receiving the following error:
Copy code
NoTransformationFoundException: No transformation found: class io.ktor.utils.io.ByteBufferChannel -> class com.my.class
I have seen this when trying ktor cannot serialize something in the data class, but right now I am using an empty class, which should be “serializable”
The response seems to be otherwise correct:
Copy code
status: 200 OK
    response headers:
    Date: Fri, 22 Jul 2022 09:33:49 GMT
    , Content-Type: text/html
    , Transfer-Encoding: chunked
So, I figured this out: the serializer will not work out of the box. What I am doing is defaulting the response to
ByteReadChannel
, and then manually serializing the object. Then it seems to work.
4 Views