Hi, getting below issue on iOS. same thing working...
# kotlin-native
v
Hi, getting below issue on iOS. same thing working fine on android. did anyone face this & resolve?
io.ktor.client.call.NoTransformationFoundException: No transformation found: class io.ktor.utils.io.ByteChannelNative -> class ...
with response from ....url:
status: 500 Internal Server Error
response headers:
x-content-type-options: nosniff
, Server:
, content-security-policy: frame-ancestors 'self';
, Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
, Via: 1.1 google
, Date: Mon, 21 Aug 2023 12:01:22 GMT
, x-xss-protection: 1;mode=block
, Content-Length: 0
, x-client-geo-location:
, Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
Copy code
Http client setup  

 fun clientHttp(url: String): HttpClient {
        return httpClient {
            expectSuccess = false
            install(Logging) {
               // level = LogLevel.BODY
                 logger = object : Logger {
                     override fun log(message: String) {
                         Napier.v(tag = "HTTP Client", message = message)
                     }
                 }
            }

            install(HttpTimeout) {
                // timeout config
                requestTimeoutMillis = 60000
                connectTimeoutMillis = 60000
                socketTimeoutMillis = 60000
            }
            install(UserAgent) {
                agent = mSettings.userAgent
            }
            install(ContentNegotiation) {
                json(json)
            }

            defaultRequest {
                url {
                    val str = getProtocol(url, MURL.URL).split("//")[1].split("/")
                    protocol = getProtocol(getProtocol(url, MURL.PROTOCOL))
                    host = str[0]
                    encodedPath = "${
                        url.split("|")[0].replace(
                            "${protocol.name}://${str[0]}",
                            ""
                        )
                    }/${getProtocol(url, MURL.METHOD)}"
                }
                header(HttpHeaders.ContentType, ContentType.Application.Json)
                accept(ContentType.Application.Json)
            }


        }.also { initLogger() }
    }
t
It seems that your server doesn't like the payload that is being sent. Would logging the payload too possibly give you insight into what is different between Android and iOS?
v
Response is coming on postman with same iOS request.
t
Add this level parameter to your logger and see if you see anything different. The server is choking on what is being sent.
Copy code
install(Logging) {
   ...
   level = LogLevel.ALL
   ...
}