Ktor 3.6.0 Is Now Available!
Summary
Ktor 3.6.0 is here! This release is full of new experimental features, including typed authentication capabilities with specialized support for OpenID Connect and HTTP/3 support for the Netty engine. There are also a few quality-of-life improvements for routing and request handling, more convenient defaults for Kotlin Multiplatform clients, and more. Check out What’s new in […]
Original Text
Ktor 3.6.0 is here! This release is full of new experimental features, including typed authentication capabilities with specialized support for OpenID Connect and HTTP/3 support for the Netty engine. There are also a few quality-of-life improvements for routing and request handling, more convenient defaults for Kotlin Multiplatform clients, and more. Check out What’s new in Ktor 3.6.0 on our website for the full list of changes, or review the release notes.
🚀 Get started with Ktor 3.6.0
Ready to explore Ktor 3.6.0? Start your next project with the interactive project generator at start.ktor.io. Your feedback and contributions are always welcome!
Get Started With Ktor 3.6.0
Typed authentication
Until now, Ktor’s authentication has relied on implicit typing to bridge configuration to the routes. In this module, you get new types to guarantee full type safety when working with complex authentication. It also supports role-based access and anonymous users. By leveraging context parameters, we were able to ensure even more elegant syntax. Read the type-safe authentication documentation for setup, role checks, and failure handling.
val jwtAuth = jwt, so it can respond with unrestricted partial HTML – with all elements supported by FlowContent.
get("/status") { call.respondHtmlPartial(HttpStatusCode.OK) { td { +"Ready" } } }
More control over ContentNegotiation
The client ContentNegotiation plugin used to merge its registered content types into every Accept header. That is usually helpful, but not when an API expects the header you set on a request to remain exactly as it is.
With ContentTypeMergeStrategy.SkipIfPresent, an explicit Accept header wins. When a request has no Accept header, the plugin continues to add the registered content types as usual:
install(ContentNegotiation) { register(ContentType.Application.Json, noOpJsonConverter) acceptHeaderMergeStrategy = ContentTypeMergeStrategy.SkipIfPresent }
Simple Kotlin Multiplatform clients
Ktor 3.6.0 introduces ktor-client-engine-defaults: a curated set of client engines for Kotlin Multiplatform projects. Add it to commonMain, and create an HttpClient() without choosing an engine in shared code. Ktor selects the appropriate available engine for each target.
The HTTP cache has moved in the same direction. File-based cache storage now uses the Path of kotlinx-io, so persistent HttpCache storage is no longer limited to JVM java.io.File APIs. Together, these improvements make setting up a KMP client with a simple cache significantly simpler:
// build.gradle.kts kotlin { sourceSets { commonMain { dependencies { api("io.ktor:ktor-client-engine-defaults:3.6.0") } } } } // Main.kt val client = HttpClient() { install(HttpCache) { publicStorage(FileStorage(Path("build/cache"))) } }
This gives Ktor projects a more natural common-code setup while retaining the option to choose and configure a specific engine whenever a platform needs it.
For the full list of 3.6.0 changes, including WebRTC support for JVM, asynchronous DNS resolution for CIO, OpenAPI tag descriptions, duplicate-cookie parsing, and JavaScript fetch() overrides, see What’s New in Ktor 3.6.0.
🙏 Thank you!
Thank you to everyone in the community for the feedback, issue reports, and contributions that help make every Ktor release better. A special thank-you to the external contributors whose work is included in the release: kdelay, Rafa Ruiz, and solo.
Start building your next project at start.ktor.io. Your suggestions and contributions are always welcome!
👉 Get Started With Ktor | 💬 Join the community on Slack
Lotu Radar provides attributed news summaries and links to the original publisher. Full reporting and copyright remain with the source.