Im encountering a strange problem: the default behavior of the .body() method doesn't use the proper serializers, but if I do it manually then it works
This works:
Copy code
private suspend inline fun <reified T> post(endpoint: String, crossinline body: () -> Any): T {
return withContext(<http://Dispatchers.IO|Dispatchers.IO>) {
val text = <http://httpClient.post|httpClient.post>("$API_URL/$endpoint") {
parameter("key", API_KEY)
setBody(body())
}.bodyAsText()
json.decodeFromString(serializer<T>(), text)
}
}