Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions codeSnippets/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ kotlin.mpp.applyDefaultHierarchyTemplate=false
org.gradle.java.installations.auto-download=false
# versions
kotlin_version = 2.3.21
ktor_version = 3.5.0
kotlinx_coroutines_version = 1.10.2
kotlinx_serialization_version = 1.9.0
ktor_version = 3.5.1
kotlinx_coroutines_version = 1.11.0
kotlinx_serialization_version = 1.11.0
kotlin_css_version = 1.0.0-pre.721
exposed_version = 1.3.0
h2_version = 2.4.240
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ val logback_version: String by project
plugins {
application
kotlin("jvm")
id("io.ktor.plugin") version "3.5.0"
id("io.ktor.plugin") version "3.5.1"
}

application {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ val DataTransformationPlugin = createClientPlugin("DataTransformationPlugin") {
}
transformResponseBody { response, content, requestedType ->
if (requestedType.type == User::class) {
val receivedContent = content.readUTF8Line()!!.split(";")
val receivedContent = content.readLine()!!.split(";")
User(receivedContent[0], receivedContent[1].toInt())
} else {
content
Expand Down
2 changes: 1 addition & 1 deletion codeSnippets/snippets/client-http-send/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repositories {

dependencies {
implementation("io.ktor:ktor-client-core:$ktor_version")
implementation("io.ktor:ktor-client-apache:$ktor_version")
implementation("io.ktor:ktor-client-apache5:$ktor_version")
implementation("ch.qos.logback:logback-classic:$logback_version")
testImplementation("junit:junit:$junit_version")
testImplementation("org.hamcrest:hamcrest:$hamcrest_version")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package com.example

import io.ktor.client.*
import io.ktor.client.engine.apache.*
import io.ktor.client.engine.apache5.*
import io.ktor.client.plugins.*
import io.ktor.client.request.*
import io.ktor.client.statement.*
import kotlinx.coroutines.*

fun main() {
runBlocking {
val client = HttpClient(Apache)
val client = HttpClient(Apache5)
client.plugin(HttpSend).intercept { request ->
val originalCall = execute(request)
if (originalCall.response.status.value !in 100..399) {
Expand Down
2 changes: 1 addition & 1 deletion codeSnippets/snippets/client-json/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repositories {

dependencies {
implementation("io.ktor:ktor-client-core:$ktor_version")
implementation("io.ktor:ktor-client-apache:$ktor_version")
implementation("io.ktor:ktor-client-apache5:$ktor_version")
implementation("io.ktor:ktor-client-content-negotiation:$ktor_version")
implementation("io.ktor:ktor-serialization-gson:$ktor_version")
implementation("ch.qos.logback:logback-classic:$logback_version")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.example

import io.ktor.client.*
import io.ktor.client.call.*
import io.ktor.client.engine.apache.*
import io.ktor.client.engine.apache5.*
import io.ktor.client.plugins.contentnegotiation.*
import io.ktor.client.request.*
import io.ktor.serialization.gson.*
Expand All @@ -12,7 +12,7 @@ data class Model(val name: String, val items: List<Item>)
data class Item(val key: String, val value: String)

fun main(args: Array<String>) = runBlocking<Unit> {
val client = HttpClient(Apache) {
val client = HttpClient(Apache5) {
install(ContentNegotiation) {
gson()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class DataTransformation {
override fun install(pipeline: ApplicationCallPipeline, configure: Configuration.() -> Unit): DataTransformation {
val plugin = DataTransformation()
pipeline.receivePipeline.intercept(ApplicationReceivePipeline.Transform) { data ->
val newValue = (data as ByteReadChannel).readUTF8Line()?.toInt()?.plus(1)
val newValue = (data as ByteReadChannel).readLine()?.toInt()?.plus(1)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
if (newValue != null) {
proceedWith(newValue)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ val DataTransformationPlugin = createApplicationPlugin(name = "DataTransformatio
onCallReceive { call ->
transformBody { data ->
if (requestedType?.type == Int::class) {
val line = data.readUTF8Line() ?: "1"
val line = data.readLine() ?: "1"
line.toInt() + 1
} else {
data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ val logback_version: String by project
plugins {
application
kotlin("jvm")
id("io.ktor.plugin") version "3.5.0"
id("io.ktor.plugin") version "3.5.1"
}

application {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ val logback_version: String by project
plugins {
application
kotlin("jvm")
id("io.ktor.plugin") version "3.5.0"
id("io.ktor.plugin") version "3.5.1"
}

application {
Expand Down
2 changes: 1 addition & 1 deletion codeSnippets/snippets/forwarded-header/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ val logback_version: String by project
plugins {
application
kotlin("jvm")
id("io.ktor.plugin") version "3.5.0"
id("io.ktor.plugin") version "3.5.1"
}

application {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ junit = "4.13.2"
kotlin = "2.4.0"
kotlin-wrappers = "2026.5.3"
kotlinx-coroutines = "1.11.0"
ktor = "3.5.0"
ktor = "3.5.1"
logback = "1.5.32"
material3 = "1.11.0-alpha07"
kotlinx-serialization-json = "1.11.0"
Expand Down
2 changes: 1 addition & 1 deletion codeSnippets/snippets/htmx-integration/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ val logback_version: String by project

plugins {
kotlin("jvm")
id("io.ktor.plugin") version "3.5.0"
id("io.ktor.plugin") version "3.5.1"
}

group = "com.example"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ val logback_version: String by project
plugins {
application
kotlin("jvm")
id("io.ktor.plugin") version "3.5.0"
id("io.ktor.plugin") version "3.5.1"
}

application {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ktor_version=3.5.0
kotlin_version=2.2.20
ktor_version=3.5.1
kotlin_version=2.3.21
logback_version=1.5.33
kotlin.code.style=official
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]
kotlin = "2.3.21"
ktor = "3.5.0"
ktor = "3.5.1"
logback = "1.5.33"

[libraries]
Expand Down
2 changes: 1 addition & 1 deletion codeSnippets/snippets/openapi-spec-gen-maven/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<properties>
<kotlin.code.style>official</kotlin.code.style>
<kotlin_version>2.3.21</kotlin_version>
<ktor_version>3.5.0</ktor_version>
<ktor_version>3.5.1</ktor_version>
<logback_version>1.5.33</logback_version>
<slf4j_version>2.0.9</slf4j_version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
2 changes: 1 addition & 1 deletion codeSnippets/snippets/openapi-spec-gen/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ val logback_version: String by project
plugins {
application
kotlin("jvm")
id("io.ktor.plugin") version "3.5.0"
id("io.ktor.plugin") version "3.5.1"
}

application {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]
kotlin = "2.3.21"
ktor = "3.5.0"
ktor = "3.5.1"
logback = "1.5.33"
opentelemetry = "2.18.1-alpha"
opentelemetry_semconv = "1.34.0"
Expand Down
2 changes: 1 addition & 1 deletion codeSnippets/snippets/proguard/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ buildscript {
plugins {
application
kotlin("jvm")
id("io.ktor.plugin") version "3.5.0"
id("io.ktor.plugin") version "3.5.1"
}

application {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ val logback_version: String by project
plugins {
application
kotlin("jvm")
id("io.ktor.plugin") version "3.5.0"
id("io.ktor.plugin") version "3.5.1"
kotlin("plugin.serialization").version("2.2.20")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ data class UserSession(val id: String, val count: Int)

fun Application.main() {
install(Sessions) {
val secretEncryptKey = hex("00112233445566778899aabbccddeeff")
val secretSignKey = hex("6819b57a326945c1968f45236589")
val secretEncryptKey = "00112233445566778899aabbccddeeff".hexToByteArray()
val secretSignKey = "6819b57a326945c1968f45236589".hexToByteArray()
cookie<UserSession>("user_session") {
cookie.path = "/"
cookie.maxAgeInSeconds = 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ data class CartSession(val userID: String, val productIDs: MutableList<Int>)

fun Application.main() {
install(Sessions) {
val secretSignKey = hex("6819b57a326945c1968f45236589")
val secretSignKey = "6819b57a326945c1968f45236589".hexToByteArray()
cookie<CartSession>("cart_session", SessionStorageMemory()) {
cookie.path = "/"
transform(SessionTransportTransformerMessageAuthentication(secretSignKey))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ data class CartSession(val userID: String, val productIDs: MutableList<Int>)

fun Application.main() {
install(Sessions) {
val secretSignKey = hex("6819b57a326945c1968f45236589")
val secretSignKey = "6819b57a326945c1968f45236589".hexToByteArray()
header<CartSession>("cart_session", directorySessionStorage(File("build/.sessions"))) {
transform(SessionTransportTransformerMessageAuthentication(secretSignKey))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fun main(args: Array<String>) {

launch(Dispatchers.IO) {
while (true) {
val greeting = receiveChannel.readUTF8Line()
val greeting = receiveChannel.readLine()
if (greeting != null) {
println(greeting)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fun main(args: Array<String>) {
sendChannel.writeStringUtf8("Please enter your name\n")
try {
while (true) {
val name = receiveChannel.readUTF8Line()
val name = receiveChannel.readLine()
sendChannel.writeStringUtf8("Hello, $name!\n")
}
} catch (e: Throwable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ androidx-testExt = "1.3.0"
composeMultiplatform = "1.9.0"
junit = "4.13.2"
kotlin = "2.3.21"
ktor = "3.5.0"
kotlinx-coroutines = "1.10.2"
ktor = "3.5.1"
kotlinx-coroutines = "1.11.0"

[libraries]
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
kotlin("jvm") version "2.3.0"
kotlin("plugin.serialization") version "2.3.0"
id("io.ktor.plugin") version "3.5.0"
id("io.ktor.plugin") version "3.5.1"
id("org.jetbrains.kotlinx.rpc.plugin") version "0.10.1"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dependencyResolutionManagement {
mavenCentral()
}
versionCatalogs {
create("ktorLibs").from("io.ktor:ktor-version-catalog:3.5.0")
create("ktorLibs").from("io.ktor:ktor-version-catalog:3.5.1")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ val h2_version: String by project
plugins {
application
kotlin("jvm")
id("io.ktor.plugin") version "3.5.0"
id("io.ktor.plugin") version "3.5.1"
id("org.jetbrains.kotlin.plugin.serialization") version "2.2.20"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<properties>
<kotlin.code.style>official</kotlin.code.style>
<kotlin_version>2.3.21</kotlin_version>
<ktor_version>3.5.0</ktor_version>
<ktor_version>3.5.1</ktor_version>
<logback_version>1.5.33</logback_version>
<slf4j_version>2.0.9</slf4j_version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencyResolutionManagement {
mavenCentral()
}
versionCatalogs {
create("ktorLibs").from("io.ktor:ktor-version-catalog:3.5.0")
create("ktorLibs").from("io.ktor:ktor-version-catalog:3.5.1")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencyResolutionManagement {
mavenCentral()
}
versionCatalogs {
create("ktorLibs").from("io.ktor:ktor-version-catalog:3.5.0")
create("ktorLibs").from("io.ktor:ktor-version-catalog:3.5.1")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencyResolutionManagement {
mavenCentral()
}
versionCatalogs {
create("ktorLibs").from("io.ktor:ktor-version-catalog:3.5.0")
create("ktorLibs").from("io.ktor:ktor-version-catalog:3.5.1")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ val logback_version: String by project
plugins {
application
kotlin("jvm")
id("io.ktor.plugin") version "3.5.0"
id("io.ktor.plugin") version "3.5.1"
}

application {
Expand Down
2 changes: 1 addition & 1 deletion help-versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"isCurrent": false
},
{
"version": "3.5.0",
"version": "3.5.1",
"url": "/docs/",
"isCurrent": true
}
Expand Down
2 changes: 1 addition & 1 deletion project.ihp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<categories src="c.list"/>
<instance src="ktor.tree"
web-path="/docs/"
version="3.5.0"
version="3.5.1"
id="docs"
keymaps-mode="none"/>

Expand Down
9 changes: 9 additions & 0 deletions topics/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ The following table lists details of the latest Ktor releases.

<table>
<tr><td>Version</td><td>Release Date</td><td>Highlights</td></tr>
<tr><td>3.5.1</td><td>June 26, 2026</td><td>
<p>
A patch release including OpenAPI plugin improvements, expanded authentication KDoc documentation, and a wide range of
bug fixes covering Kotlin 2.4 compiler compatibility, HTTP and caching behavior, authentication, WebRTC stability, and
platform-specific issues across JVM, Darwin, Android, and Windows.
</p>
<var name="version" value="3.5.1"/>
<include from="lib.topic" element-id="release_details_link"/>
</td></tr>
<tr><td>3.5.0</td><td>May 15, 2026</td><td>
<p>
A minor release that introduces RFC 7616 Digest authentication support, custom DNS resolver configuration for OkHttp
Expand Down
2 changes: 1 addition & 1 deletion topics/server-custom-plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ handle `transformBody` inside `onCallReceive` as follows:
used to check the requested data type.
2. `data` is a lambda argument that allows you to receive a request body
as [ByteReadChannel](https://api.ktor.io/ktor-io/io.ktor.utils.io/-byte-read-channel/index.html) and convert it to
the required type. In the example above, `ByteReadChannel.readUTF8Line` is used to read a request body.
the required type. In the example above, `ByteReadChannel.readLine()` is used to read a request body.
3. Finally, you need to transform and return data. In our example, `1` is added to the received integer value.

You can find the full example
Expand Down
Loading