Skip to content

Bump Ktor version to 3.5.1 and add release details#832

Merged
Vik Nikolova (vnikolova) merged 3 commits into
mainfrom
3.5.1
Jun 29, 2026
Merged

Bump Ktor version to 3.5.1 and add release details#832
Vik Nikolova (vnikolova) merged 3 commits into
mainfrom
3.5.1

Conversation

@vnikolova

Copy link
Copy Markdown
Collaborator
  • Bump Ktor version from 3.5.0 to 3.5.1
  • Add release details
  • Fix Kotlin, serialization, coroutines and logback versions inconsistencies
  • Replace deprecated Kotlin functions in samples
  • Replace deprecated Apache engine in samples

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e4115e65-9cdf-49db-ae4a-dfc393a0aec4

📥 Commits

Reviewing files that changed from the base of the PR and between 246011c and 9003bfa.

📒 Files selected for processing (2)
  • codeSnippets/snippets/openapi-spec-gen-maven/gradle/libs.versions.toml
  • codeSnippets/snippets/tutorial-server-routing-and-requests/settings.gradle.kts

Walkthrough

Updated Ktor-related version pins, build plugins, and release metadata to 3.5.1. Sample code was also adjusted to use Apache5 clients, readLine() parsing, and hexToByteArray() for session keys.

Changes

Ktor 3.5.1 updates

Layer / File(s) Summary
Version pins and catalogs
codeSnippets/gradle.properties, codeSnippets/snippets/migrating-express-ktor/gradle.properties, codeSnippets/snippets/full-stack-task-manager/gradle/libs.versions.toml, codeSnippets/snippets/opentelemetry/gradle/libs.versions.toml, codeSnippets/snippets/tutorial-client-kmp/gradle/libs.versions.toml, codeSnippets/snippets/openapi-spec-gen-maven/pom.xml, codeSnippets/snippets/openapi-spec-gen-maven/gradle/libs.versions.toml, codeSnippets/snippets/tutorial-server-get-started-maven/pom.xml, codeSnippets/snippets/tutorial-server-db-integration/settings.gradle.kts, codeSnippets/snippets/tutorial-server-restful-api/settings.gradle.kts, codeSnippets/snippets/tutorial-server-web-application/settings.gradle.kts, v.list
Shared version properties, version catalogs, Maven properties, and v.list entries were updated to new Ktor, Kotlin, coroutines, and serialization versions.
Gradle plugin bumps
codeSnippets/snippets/aws-elastic-beanstalk/build.gradle.kts, codeSnippets/snippets/deployment-ktor-plugin/build.gradle.kts, codeSnippets/snippets/engine-main-custom-environment/build.gradle.kts, codeSnippets/snippets/forwarded-header/build.gradle.kts, codeSnippets/snippets/htmx-integration/build.gradle.kts, codeSnippets/snippets/legacy-interactive-website/build.gradle.kts, codeSnippets/snippets/openapi-spec-gen/build.gradle.kts, codeSnippets/snippets/proguard/build.gradle.kts, codeSnippets/snippets/server-websockets-sharedflow/build.gradle.kts, codeSnippets/snippets/tutorial-kotlin-rpc-app/build.gradle.kts, codeSnippets/snippets/tutorial-server-docker-compose/build.gradle.kts, codeSnippets/snippets/tutorial-website-static/build.gradle.kts
The Ktor Gradle plugin version was changed from 3.5.0 to 3.5.1 across the sample build scripts.
Apache5 client migration
codeSnippets/snippets/client-http-send/build.gradle.kts, codeSnippets/snippets/client-http-send/src/main/kotlin/com/example/Application.kt, codeSnippets/snippets/client-json/build.gradle.kts, codeSnippets/snippets/client-json/src/main/kotlin/com/example/JsonClient.kt
The client snippets switch from ktor-client-apache/Apache to ktor-client-apache5/Apache5 in both dependencies and HttpClient setup.
Line parsing updates
codeSnippets/snippets/custom-plugin-base-api/src/main/kotlin/com/example/plugins/DataTransformation.kt, codeSnippets/snippets/custom-plugin/src/main/kotlin/com/example/plugins/DataTransformationPlugin.kt, codeSnippets/snippets/client-custom-plugin-data-transformation/src/main/kotlin/com/example/plugins/DataTransformation.kt, codeSnippets/snippets/sockets-server/src/main/kotlin/com/example/Application.kt, codeSnippets/snippets/sockets-client/src/main/kotlin/com/example/Application.kt, topics/server-custom-plugins.md
The custom plugin, client data transformation, socket examples, and related docs replace readUTF8Line() with readLine() in their line-reading paths.
Session key conversion
codeSnippets/snippets/session-cookie-client/src/main/kotlin/cookieclient/Application.kt, codeSnippets/snippets/session-cookie-server/src/main/kotlin/com/example/Application.kt, codeSnippets/snippets/session-header-server/src/main/kotlin/com/example/Application.kt
The session cookie and header examples now derive signing and encryption keys with hexToByteArray() instead of hex(...).
Release and docs metadata
topics/releases.md, help-versions.json, project.ihp
The release notes, help version entry, and docs site config were updated for 3.5.1.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • Stexxe
  • bjhham
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly reflects the main change: bumping Ktor to 3.5.1 and adding release details.
Description check ✅ Passed The description is directly related to the changeset and mentions the main version bumps, release details, and sample updates.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 3.5.1

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
codeSnippets/snippets/client-http-send/src/main/kotlin/com/example/Application.kt (1)

10-23: 🩺 Stability & Availability | 🟡 Minor

Close the HttpClient to prevent resource leaks.

The HttpClient instance constructed with the Apache5 engine initializes thread pools and network resources that are not reclaimed until the client is explicitly closed. Leaving it open in a runBlocking scope without a finally block or use {} handler can cause thread leaks and prevent the JVM from exiting cleanly in repeated test runs or long-lived processes. Wrap the client usage in a try/finally block to ensure client.close() is always called.

Suggested fix
 fun main() {
     runBlocking {
         val client = HttpClient(Apache5)
+        try {
             client.plugin(HttpSend).intercept { request ->
                 val originalCall = execute(request)
                 if (originalCall.response.status.value !in 100..399) {
                     execute(request)
                 } else {
                     originalCall
                 }
             }
             val response: HttpResponse = client.get("https://ktor.io")
             println(response.status)
+        } finally {
+            client.close()
+        }
     }
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@codeSnippets/snippets/client-http-send/src/main/kotlin/com/example/Application.kt`
around lines 10 - 23, The HttpClient created in main with Apache5 is never
closed, which can leak threads and network resources. Update the client usage
around the HttpSend intercept and client.get call to ensure client.close() is
always invoked, ideally by wrapping the existing runBlocking body in a
try/finally or equivalent cleanup pattern so the client is released even if the
request fails.
codeSnippets/snippets/client-json/src/main/kotlin/com/example/JsonClient.kt (1)

14-27: 🩺 Stability & Availability | 🟡 Minor

Release the Apache5 client when the sample finishes.

The HttpClient(Apache5) instance created in main is never closed, which can lead to resource leaks (file descriptors, threads) after the sample completes. Since HttpClient implements AutoCloseable, wrap the usage in a use block for idiomatic Kotlin resource management.

Suggested fix
 fun main(args: Array<String>) = runBlocking<Unit> {
-    val client = HttpClient(Apache5) {
+    val client = HttpClient(Apache5) {
         install(ContentNegotiation) {
             gson()
         }
     }
-    println("Requesting model...")
-    val model: Model = client.get("http://0.0.0.0:8080/v1").body()
-    println("Fetching items for '${model.name}'...")
-    for ((key, _) in model.items) {
-        val item: Item = client.get("http://0.0.0.0:8080/v1/item/$key").body()
-        println("Received: $item")
-    }
+    client.use {
+        println("Requesting model...")
+        val model: Model = it.get("http://0.0.0.0:8080/v1").body()
+        println("Fetching items for '${model.name}'...")
+        for ((key, _) in model.items) {
+            val item: Item = it.get("http://0.0.0.0:8080/v1/item/$key").body()
+            println("Received: $item")
+        }
+    }
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@codeSnippets/snippets/client-json/src/main/kotlin/com/example/JsonClient.kt`
around lines 14 - 27, The Apache5 HttpClient in main is never released after the
sample completes, so update the JsonClient main flow to use Kotlin’s idiomatic
resource handling by wrapping the HttpClient(Apache5) creation and all request
logic in a use block on the HttpClient instance. Keep the existing request/print
logic inside that block so the client is automatically closed when main
finishes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@codeSnippets/snippets/custom-plugin-base-api/src/main/kotlin/com/example/plugins/DataTransformation.kt`:
- Line 16: The code snippet is already migrated to ByteReadChannel.readLine(),
but the accompanying docs prose still refers to readUTF8Line, so update the
surrounding explanation in the custom plugin documentation to match the sample
and use the new method name consistently. Check the text that describes the
DataTransformation example and replace any leftover readUTF8Line references so
the narrative stays aligned with the snippet.

---

Outside diff comments:
In
`@codeSnippets/snippets/client-http-send/src/main/kotlin/com/example/Application.kt`:
- Around line 10-23: The HttpClient created in main with Apache5 is never
closed, which can leak threads and network resources. Update the client usage
around the HttpSend intercept and client.get call to ensure client.close() is
always invoked, ideally by wrapping the existing runBlocking body in a
try/finally or equivalent cleanup pattern so the client is released even if the
request fails.

In `@codeSnippets/snippets/client-json/src/main/kotlin/com/example/JsonClient.kt`:
- Around line 14-27: The Apache5 HttpClient in main is never released after the
sample completes, so update the JsonClient main flow to use Kotlin’s idiomatic
resource handling by wrapping the HttpClient(Apache5) creation and all request
logic in a use block on the HttpClient instance. Keep the existing request/print
logic inside that block so the client is automatically closed when main
finishes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 93cc900c-2db6-47f7-b2cf-84c9893714be

📥 Commits

Reviewing files that changed from the base of the PR and between de16b87 and 37991ce.

📒 Files selected for processing (38)
  • codeSnippets/gradle.properties
  • codeSnippets/snippets/aws-elastic-beanstalk/build.gradle.kts
  • codeSnippets/snippets/client-custom-plugin-data-transformation/src/main/kotlin/com/example/plugins/DataTransformation.kt
  • codeSnippets/snippets/client-http-send/build.gradle.kts
  • codeSnippets/snippets/client-http-send/src/main/kotlin/com/example/Application.kt
  • codeSnippets/snippets/client-json/build.gradle.kts
  • codeSnippets/snippets/client-json/src/main/kotlin/com/example/JsonClient.kt
  • codeSnippets/snippets/custom-plugin-base-api/src/main/kotlin/com/example/plugins/DataTransformation.kt
  • codeSnippets/snippets/custom-plugin/src/main/kotlin/com/example/plugins/DataTransformationPlugin.kt
  • codeSnippets/snippets/deployment-ktor-plugin/build.gradle.kts
  • codeSnippets/snippets/engine-main-custom-environment/build.gradle.kts
  • codeSnippets/snippets/forwarded-header/build.gradle.kts
  • codeSnippets/snippets/full-stack-task-manager/gradle/libs.versions.toml
  • codeSnippets/snippets/htmx-integration/build.gradle.kts
  • codeSnippets/snippets/legacy-interactive-website/build.gradle.kts
  • codeSnippets/snippets/migrating-express-ktor/gradle.properties
  • codeSnippets/snippets/openapi-spec-gen-maven/pom.xml
  • codeSnippets/snippets/openapi-spec-gen/build.gradle.kts
  • codeSnippets/snippets/opentelemetry/gradle/libs.versions.toml
  • codeSnippets/snippets/proguard/build.gradle.kts
  • codeSnippets/snippets/server-websockets-sharedflow/build.gradle.kts
  • codeSnippets/snippets/session-cookie-client/src/main/kotlin/cookieclient/Application.kt
  • codeSnippets/snippets/session-cookie-server/src/main/kotlin/com/example/Application.kt
  • codeSnippets/snippets/session-header-server/src/main/kotlin/com/example/Application.kt
  • codeSnippets/snippets/sockets-client/src/main/kotlin/com/example/Application.kt
  • codeSnippets/snippets/sockets-server/src/main/kotlin/com/example/Application.kt
  • codeSnippets/snippets/tutorial-client-kmp/gradle/libs.versions.toml
  • codeSnippets/snippets/tutorial-kotlin-rpc-app/build.gradle.kts
  • codeSnippets/snippets/tutorial-server-db-integration/settings.gradle.kts
  • codeSnippets/snippets/tutorial-server-docker-compose/build.gradle.kts
  • codeSnippets/snippets/tutorial-server-get-started-maven/pom.xml
  • codeSnippets/snippets/tutorial-server-restful-api/settings.gradle.kts
  • codeSnippets/snippets/tutorial-server-web-application/settings.gradle.kts
  • codeSnippets/snippets/tutorial-website-static/build.gradle.kts
  • help-versions.json
  • project.ihp
  • topics/releases.md
  • v.list

@vnikolova Vik Nikolova (vnikolova) merged commit d118418 into main Jun 29, 2026
1 check was pending
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants