How can I prevent this ktor-client exception when ...
# ktor
l
How can I prevent this ktor-client exception when the response type is nullable and the body is empty?
Copy code
ReceivePipelineException: Fail to run receive pipeline: NoTransformationFoundException: No transformation found: class JsHttpResponse -> class ExerciseProgressDTO
e
Hi, @Lawik . What version of ktor do you use?
l
Copy code
implementation "io.ktor:ktor-client-js:1.1.3" implementation "io.ktor:ktor-client-json-js:1.1.3"
Though, maybe it will be solved if my body contains an empty json object instead? I'll give that a try too.
Nevermind, that gives me a MissingFieldException.
d
You can configure Jackson not to fail on empty beans
(disableFeature(DeserializationFeature.FAIL_ON_EMPTY_BEANS)
l
My problem is on the frontend though, I want ktor to return null when my body is empty and my response type is nullable.
d
Ktor (as far as I can tell) only supports passing
KClass<T>
, which would mean that this is not possible. It would need some kind of Type Token to support this.