Kotlin logo

Kotlin

A concise multiplatform language developed by JetBrains

Ktor News Releases

Ktor 3.2.2 Is Now Available

The Ktor 3.2.2 patch release brings a critical fix for Android D8 compatibility, along with some minor enhancements and bug fixes.

🚀 Get started

Ready to explore Ktor 3.2.2? Start building your next project today with our interactive project generator at start.ktor.io. Your feedback and contributions are always welcome!

🔗 Get Started With Ktor | 📢 Join the Community on Reddit and Slack

Fixed Android D8 compatibility

Ktor 3.2.0 introduced a compatibility issue for Android’s D8 by using Kotlin’s backticked identifiers, which are commonly used in testing and allow for non-alphanumeric characters in Kotlin names. Android’s D8 tool, which converts bytecode to DEX  (Dalvik executable) format, only supports these backticked identifiers on Android 10 (API level 30) and newer.

@Test
fun `hello world returns 200`() = testApplication {
    routing {
        get("/hello") {
            call.respondText("Hello World!")
        }
     }
     val response = client.get("/hello")
     assertEquals(HttpStatusCode.OK, response.status)
}

This regression is fixed in Ktor 3.2.2. To prevent this from happening again, we’ve added new checks to our testing infrastructure. These tests continuously verify Ktor’s compatibility with essential Android tools, including D8 and ProGuard, ensuring new features don’t break support for older Android versions. More details can be found on YouTrack and on GitHub.

Minor bug fixes and enhancements

Improvements

  • Thymeleaf: The template model now accepts null values (KTOR-8559).
  • javadoc now published as a Maven artifact (KTOR-3962).
  • Netty: An invalid hex byte with a malformed query string now returns the expected 400 Bad Request error instead of a 500 Internal Server Error.  (KTOR-2934).


It automatically closes AutoCloseable instances or allows to configure your own cleanup handlers. When the server receives a stop command, the HikariDataSource will close automatically, and then the custom cleanup handler for Database will be executed.

Regression fixes

  • A Space characters in SimpleName error is no longer triggered when executing an R8 mergeExtDex task with 3.2.0 (KTOR-8583).
  • A potential race condition no longer occurs in socket.awaitClosed (KTOR-8618).
  • The module parameter type Application.() -> kotlin.Unit is now supported (KTOR-8602).
  • Collecting flow in a Ktor route no longer results in a Flow invariant is violated error (KTOR-8606).

Bug fixes

  • ForwardedHeaders: The plugin now handles parameters case-insensitively, as expected (KTOR-8622).
  • OkHttp: java.net.ProtocolException no longer occurs when sending MultiPartFormDataContent with onUpload (KTOR-6790).
  • The OAuth2 authentication provider no longer breaks form-urlencoded POST requests when receiving the request body (KTOR-4420).
  • The You can learn more from Content negotiation and serialization KDoc link for io.ktor.server.plugins.contentnegotiation.ContentNegotiation now leads to the correct page (KTOR-8597).
  • Ktor no longer fails to boot with the default jvminline argument (KTOR-8608).
  • The ResponseSent hook handler of the plugin installed into a route is now executed as expected when an exception is thrown from the route (KTOR-6794).

🚀 Thank you!

We want to thank everyone in the community for your support and feedback, as well as for reporting issues.

Start building your next project at start.ktor.io. Your suggestions and contributions are always welcome!

🔗 Get Started With Ktor | 📢 Join the Community on Reddit and Slack

image description