pushpull
02/25/2026, 2:41 AMinstall(StatusPages) {
exception<Exception> { call, _ ->
call.respond(HttpStatusCode.BadRequest, "Invalid request format")
logger.error("Unhandled exception occurred")
}
this.unhandled {
logger.error("Unhandled exception occurred", it)
}
}
install(StatusPages) {
exception<ContentTransformationException> { call, _ ->
call.respond(HttpStatusCode.BadRequest, "Invalid request format")
}
exception<io.ktor.server.plugins.ContentTransformationException> { call, _ ->
call.respond(HttpStatusCode.BadRequest, "Invalid request format")
}
}Aleksei Tirman [JB]
02/25/2026, 7:26 AM/api/v1/register route handler and the request that leads to the error, preferably as a curl command?pushpull
02/26/2026, 4:02 AMcurl --request POST \
--url <https://example.com/api/v1/register> \
--header 'content-type: application/json' \
--data '{
"username": "username",
"email": "<mailto:email@example.com|email@example.com>",
"password": "password"
}'pushpull
02/26/2026, 4:06 AMcurl --request POST \
--url <https://example.com/api/v1/register> \
--header 'content-type: application/json'
415 Unsupported Media Type
Cannot transform this request's content to com.app.SetupRequest.RegisterAleksei Tirman [JB]
02/26/2026, 8:27 AMcom.app.SetupRequest.Register and the serialization configuration?pushpull
02/27/2026, 3:54 AM@Serializable
data class Register(val username: String, val email: String, val password: String)
thats simply a data class with kotlinx serialization
and post request is created as
post<SetupRoute.Register, SetupRequest.Register> { _, registerData ->
val response = setupResource.handleRegistration(registerData = registerData)
call.respond(apiResponse = response)
}pushpull
02/27/2026, 3:56 AMAleksei Tirman [JB]
02/27/2026, 8:55 AMRegister class.pushpull
02/28/2026, 2:40 AM