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

Javier

07/21/2022, 12:37 PM
I am getting an issue when combining
MockEngine
with
Json
, but the same exact logic is working when fetching from remote, more info in 🧵
Copy code
No transformation found: class io.ktor.utils.io.ByteBufferChannel -> class com.javiersc.either.network.ktor.TodoDTO
with response from <http://localhost/path>:
status: 200 OK
response headers: 

io.ktor.client.call.NoTransformationFoundException: No transformation found: class io.ktor.utils.io.ByteBufferChannel -> class com.javiersc.either.network.ktor.TodoDTO
with response from <http://localhost/path>:
status: 200 OK
response headers:
image.png,image.png
the
CIO
one is working perfectly, meanwhile the
MockEngine
one, which I think is doing the same, it fails
TodoDTO
is the same class for both tests
The
TODO
string can be serialized if I use it with the Json without using Ktor
a

Aleksei Tirman [JB]

07/21/2022, 5:19 PM
Could you please try to respond with the
Content-Type
header?
Copy code
respond(TODO, headers = headersOf(HttpHeaders.ContentType, ContentType.Application.Json.toString()))
j

Javier

07/21/2022, 8:45 PM
It works! thank you 🙂