Is there a way to make Ktor client receive json ev...
# ktor
d
Is there a way to make Ktor client receive json even though the server it tries to get it from doesn't set the response's content type to json?
d
Thanks! I guess it would have been nicer to set that per request, but it's certainly better than nothing!
a
You can also set it per request if you want to.
d
You mean install it for only a certain request? Or some other way?
a
Unfortunately, there is no way to install the
ContentNegotiation
plugin for an individual request.
😧 1
d
The use-case is some non-standard complying endpoints... two separate clients would need to be used in such cases...
a
I would just receive a response body as byte array or a string and deserialize it manually with the
kotlinx.serialization
framework.
d
Yeah, that's what I did... but that's not so nice hardcoding the dependency of a concrete serialization framework in the middle of my service code...
It would have been a bit nicer to be able to override this behaviour...