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

Giuliopime

04/14/2022, 9:36 AM
Why is ktor not able to parse the res to a data class? I have the contentNegotiation plugin installed
Copy code
client = HttpClient(CIO) {
            install(ContentNegotiation) {
                jackson()
            }
        }
g

gildor

04/14/2022, 9:39 AM
Because it returns HttpResponse and should use .body() to convert it to required type
3
Ktor 1.x had all those top level methods like get/post/etc which return generic types, not anymore, all methods in Ktor 2.0 return now HttpRequest and you return required representation
g

Giuliopime

04/14/2022, 9:42 AM
Ah damn didn't scroll enough in the code sry haha
😄 1
Thank you a lot
4 Views