I’m currently using ktor in multiplatform project ...
# ktor
e
I’m currently using ktor in multiplatform project as a client, does anybody know how to replace the request body after it has been encoded to json string. I have tried below approach:
Copy code
client.requestPipeline.intercept(HttpRequestPipeline.Before) {
    val body = context.body
}
but since context.body is an data class (not an encoded string), and I could not encode it using kotlinx.serializer because I don’t have correspoding serializer of that data class at this moment (the type of
context.body
is Any). Thus I don’t know how to do that with a generic interceptor. The initial requirement is to encrypt the body and replace it.