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

Javier

08/21/2020, 12:00 PM
Is it possible to wrap the model of a response with another custom model via custom feature? Is there a similar feature created to take a look to it?
Copy code
client.get<MyWrapper<SomeModel>>(...)
Ktor client, not server
n

Nikky

08/21/2020, 2:36 PM
i am not sure you can return a different thing than what you are requestingin the pipeline model is there any downside to just having a extension to wrap it after the request is done ? what do you currently use to map the response to the type ?
j

Javier

08/21/2020, 3:08 PM
Yeah, after the request is done. It is a sealed class (success, error and more)
I prefer it as feature, because I have one for retrofit too
@Nikky I got the wrapper, but I am getting a ByteBufferChannel in the internal object, instead of the real object. I think it is caused because both features, Json and mine, can work together. Do you know if is there a way to depends of another feature?
n

Nikky

08/23/2020, 6:25 AM
never done this.. so.. no clue