Hi, I am using ktor server ContentNegotiation features setup like this
Copy code
install(ContentNegotiation) {
json()
}
on the client side, I use kotlinx-serialization to serialize a sealed class and post it to server but it doesn't work because the kotlinx-serialization produces different format than ktor-server expects. I thought they are supposed to use the same format. What is the way to make them work together?
Milan Hruban
05/23/2020, 6:15 AM
For now, I hacked it by changing
Copy code
post<MyDto> { myDto ->
//stuff
}
to
Copy code
post {
val myDto = mySerializer.parse<MyDto>(call.receiveText())
//stuff
}
k
Kirill Prybylsky
05/25/2020, 10:25 AM
why do you need now ContentNegotiation? you are doing mapping by hands now
m
Milan Hruban
05/25/2020, 10:32 AM
yes, but I don't want to - I wanted to use the contentNegotiation feature, but it doesn't work as I expected