Vinod Rai
08/21/2023, 12:03 PMio.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
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() }
}
Trey
08/21/2023, 2:13 PMVinod Rai
08/22/2023, 5:56 AMTrey
08/22/2023, 12:04 PMinstall(Logging) {
...
level = LogLevel.ALL
...
}