Jay
08/28/2025, 6:02 AMalbrechtroehm
08/28/2025, 9:12 AMtestApplication
?Dewan Tawsif
08/28/2025, 12:58 PMCacheControl.FORCE_CACHE
to achieve this behavior.Yoonho Aaron Kim
08/29/2025, 5:48 AMval ktorInterceptor = createClientPlugin("InterceptorPlugin") {
transformResponseBody { response, content, requestedType ->
content
}
}
...
HttpClient(Android) {
install(Logging) {
logger = Logger.ANDROID
}
install(ktorInterceptor)
}
suspend fun getUser(): RespUser {
return client.get(url).body()
}
-> java.lang.IllegalStateException: transformResponseBody returned io.ktor.utils.io.SourceByteReadChannel@7e05379 but expected value of type TypeInfo(RespUser (Kotlin reflection is not available))
How can I resolve this?
I also asked on the stackoverflow tooMario Andhika
08/29/2025, 9:18 AMYassine Abou
08/30/2025, 12:18 PMskominas.ainis
08/31/2025, 12:24 PMk k
08/31/2025, 2:21 PMon(ResponseSent)
, the status is nullable:
on(ResponseSent) { call ->
call.response.status() // => HttpStatusCode?
Arjan van Wieringen
08/31/2025, 6:12 PMAlyona Chernyaeva
09/01/2025, 7:55 AMjamshedalamqaderi
09/01/2025, 10:45 AMNSURLSessionAuthChallengePerformDefaultHandling
and NSURLSessionAuthChallengeUseCredential
. The completionHandler’s first parameter (disposition) appears to have a mismatched expected type across targets/toolchains (Int vs Long), causing “Argument type mismatch” errors.
https://github.com/JamshedAlamQaderi/appwrite-kmp/blob/eab65e933c0e794b686592559c1[…]iosMain/kotlin/com/jamshedalamqaderi/kmp/appwrite/Client.ios.ktTiago
09/01/2025, 2:06 PMskominas.ainis
09/02/2025, 4:46 PMStefan Oltmann
09/04/2025, 11:25 AMcommonMain
off?
At start it logs this:
[INFO] (io.ktor.server.Application): Application started in 0.0 seconds.
[INFO] (io.ktor.server.Application): Responding at <http://127.0.0.1:49991>
Even the macOS / mingW binaries log this at start.
I want it to be completely silent.
I think it comes from here:
https://github.com/ktorio/ktor/blob/b7face18342805d8a0eb77bb711d72aea5cd49a3/ktor-[…]-core/common/src/io/ktor/server/engine/BaseApplicationEngine.ktgpopides
09/04/2025, 1:57 PMAlex Styl
09/04/2025, 1:58 PM./gradlew demo:jvmRun -Pio.ktor.development=true -t
phldavies
09/04/2025, 5:42 PM404
response as null
without either losing the default response validation (i.e expectSuccess = false
) or intercepting ClientRequestException
?Arjan van Wieringen
09/05/2025, 12:13 PMAlex Styl
09/06/2025, 9:49 AMsuyash
09/07/2025, 7:48 PMpost {
val newTask = getTask()
val id = helper.createTask(newTask)
call.respond(HttpStatusCode.Created, mapOf("id" to id))
}
private suspend fun RoutingContext.getTask(): CreateTaskType =
runCatching { call.receive<CreateTaskType>() }.getOrElse {
throw BadRequestException("Required fields missing ")
}
--------------------------------------------------------------------------
validate<CreateTaskType> { task ->
if (task.name.length > 10)
ValidationResult.Invalid("XYz")
else ValidationResult.Valid
}
--------------------------------------------------------------------------
exception<RequestValidationException> { call, cause ->
call.respond(HttpStatusCode.BadRequest, cause.reasons.joinToString())
}
exception<BadRequestException> { call, cause ->
call.respond(HttpStatusCode.Conflict, cause.message)
}
My issue is everytime I make a Faulty API Call I get a BadRequestException => 409 with error Message "Required fields missing"
I never get a RequestValidationException => 400 with error Message
how can I prevent that and is there a better way to do such things?Carl-Johan Larsson
09/08/2025, 12:10 PMRoger Kreienbühl
09/08/2025, 8:27 PMonResponse
Philip Segerfast
09/10/2025, 4:03 PMval client = HttpClient {
plugins.forEach {
install(it)
}
}
We started with the Logger. Our idea was to create a custom plugin that installs the Logger and itself and configures it but we found out that you can't do that with Plugins (or can you?).
The official documentation asks you to just install Logger explicitly in the HttpClientConfig but we want to do this outside of HttpClient.
Is there a common approach on how to do this?
Here's one idea I had:
interface KtorInstallable {
fun HttpClientConfig<*>.install()
}
interface PlatformLogger {
fun logKtor(message: String)
}
class CustomLoggerPlugin(
private val platformLogger: PlatformLogger,
) : KtorInstallable {
override fun HttpClientConfig<*>.install() {
install(Logging) {
logger = object : Logger {
override fun log(message: String) {
platformLogger.logKtor(message)
}
}
}
}
}
class CustomHttpClient(plugins: List<KtorInstallable>) {
val client = HttpClient {
plugins.forEach { plugin ->
plugin.run { install() }
}
}
}
We are quite new to Ktor.
Thank you!!ursus
09/11/2025, 2:53 AMsindrenm
09/12/2025, 7:51 AMRey (Kingg22)
09/13/2025, 5:50 PMMarc
09/13/2025, 10:27 PMStefan Oltmann
09/14/2025, 1:34 PMAlex Styl
09/15/2025, 6:28 AMcss
and an other called public
. I want the contents of both to be served at /
Emre
09/18/2025, 4:55 PMgradle kotest
? This started happening after I upgraded my dependencies; ktor kotest kotlin etc. I should note that I do use an openapi plugin, but not the ktor one: https://github.com/SMILEY4/ktor-openapi-tools