Hey I am working in ktor. I am following this answer. I want to use responsePipeline on my androidMain. But I am getting error Unresolved reference: responsePipeline. Actually I created my HttpClient with OkHttp in my androidMain. I don't know why I cannot use in my file. Can someone please guide me.
androidMain
actual fun httpClient(config: HttpClientConfig<*>.() -> Unit) = HttpClient(OkHttp) {
responsePipeline.intercept(HttpResponsePipeline.Transform) {
}
config(this)
install(Logging) {
logger = Logger.SIMPLE
level = LogLevel.BODY
}
}
commonMain
expect fun httpClient(config: HttpClientConfig<*>.() -> Unit = {}): HttpClient
Error

responsePipelineis a property ofHttpClientclass, and you are trying to access it on an instance ofHttpClientConfig.Lamda of
HttpClient(OkHttp)returns an object of typeHttpClientConfigwhich doesn't have a property namedreponsePipeline.To use
responsePipelineyou have to create an instance ofHttpClient, and after that you can use it.You can create a method which returns your configured
httpClientAssign this to the actual definition.