robercoding
07/19/2023, 6:29 AM"No transformation found: class ByteChannelJS -> class Fact
with response from <https://catfact.ninja/fact>:
status: 200
response headers:
cache-control: no-cache, private
, content-type: application/json"
robercoding
07/19/2023, 6:30 AMval client = HttpClient(Js) {
install(Resources)
install(ContentNegotiation) {
Json {
prettyPrint = true
isLenient = true
ignoreUnknownKeys = true
}
}
}
The request:
val fact: Fact = client.get("<https://catfact.ninja/fact>").body<Fact>()
And the data class
@Serializable
data class Fact(val fact: String)
I feel like everything is in place but I don’t know if i’m missing something. I’ve re-read the docs over and over and still can’t find the issue
By any chance, do you see something’s off or what could be missing?robercoding
07/19/2023, 6:32 AMJson
to my client content negotiation. So how is that it doesn’t know how to transform it?robercoding
07/19/2023, 6:33 AMrobercoding
07/19/2023, 8:00 AMJson
on my IDE and doing nothing.
Now the issue is solved, spent 3 hours on this bloodtrail
val client = HttpClient(Js) {
install(Resources)
install(ContentNegotiation) {
json(
Json {
prettyPrint = true
isLenient = true
ignoreUnknownKeys = true
}
)
}
}
Andromadus Naruto
07/19/2023, 11:51 AM