Hi! I'm getting an issue with the ktor client, when I try to make a post request, throws a rare error:
override suspend fun addLocation(location: Location): Unit = <http://client.post|client.post> {
path(LOCATION)
body = location
}
It throws
java.lang.ClassCastException: com.sergiocasero.model.Location cannot be cast to io.ktor.client.call.HttpClientCall
My first impression was a problem with the serializer, but
override suspend fun getLocation(parent: Int): Location =
client.get<Location> { path("$LOCATION/$parent") }
works perfect, the model is quite simple:
@Serializable
data class Location(
val id: Int,
val parentId: Int,
val name: String
)
Any suggestions?