zt
05/15/2023, 5:44 AMio.ktor.serialization.ContentConvertException: No suitable converter found for TypeInfo(type=class com.zt.tempus.ui.viewmodel.Res, reifiedType=class com.zt.tempus.ui.viewmodel.Res, kotlinType=com.zt.tempus.ui.viewmodel.Res)
in my android app, but I have no clue what I'm doing wrong. I've added the content negotion library, and set it up for json. I applied kotlinx serialization gradle plugin and marked my classes as serializable.
private val httpClient = HttpClient(CIO) {
install(ContentNegotiation) {
json(json)
}
install(HttpCookies) {
storage = AcceptAllCookiesStorage()
}
install(ContentEncoding) {
gzip()
deflate()
}
defaultRequest {
contentType(ContentType.Application.Json)
}
}
Aleksei Tirman [JB]
05/15/2023, 7:16 AMhttpClient
?zt
05/15/2023, 4:04 PMhttpClient.get(URL) {
header("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0")
header("Accept", "*/*")
header("Accept-Language", "en-US,en;q=0.5")
header("Accept-Encoding", "gzip, deflate, br")
header("Referer", "<https://www.tiktok.com/>")
header("Origin", "<https://www.tiktok.com>")
header("DNT", "1")
header("Connection", "keep-alive")
header("Sec-Fetch-Dest", "empty")
header("Sec-Fetch-Mode", "cors")
header("Sec-Fetch-Site", "same-site")
header("Pragma", "no-cache")
header("Cache-Control", "no-cache")
}
._body_(_typeInfo_<_Trending_>())
instead of body<Trending>()
then it works, but thats not as convenient