Skip to content

Commit

Permalink
bump ktor
Browse files Browse the repository at this point in the history
  • Loading branch information
osoykan committed Feb 17, 2025
1 parent 8ec7228 commit 9744741
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
1 change: 0 additions & 1 deletion examples/ktor-example/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ dependencies {
}

dependencies {
testImplementation(libs.ktor.server.tests.jvm)
testImplementation(libs.kotest.property)
testImplementation(libs.kotest.runner.junit5)
testImplementation(libs.logback.classic)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ fun run(
mainModule(config, applicationOverrides)
}

applicationEngine.environment.monitor.subscribe(ApplicationStarted) {
applicationEngine.monitor.subscribe(ApplicationStarted) {
it.get<ExampleAppConsumer<String, Any>>().start()
}

applicationEngine.environment.monitor.subscribe(ApplicationStopping) {
applicationEngine.monitor.subscribe(ApplicationStopping) {
it.get<ExampleAppConsumer<String, Any>>().stop()
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ kafka-streams-registry = "7.8.1"
dokka = "2.0.0"
knit = "0.5.0"
kover = "0.9.1"
ktor = "2.3.13"
ktor = "3.1.0"
koin = "4.0.2"
r2dbc-spi = "1.0.0.RELEASE"
r2dbc-postgresql = "0.8.13.RELEASE"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import kotlinx.coroutines.flow.*
fun <T> HttpStatement.readJsonTextStream(transform: suspend (line: String) -> T): Flow<T> = flow {
execute {
check(it.status.isSuccess()) { "Request failed with status: ${it.status}" }
while (!it.content.isClosedForRead) {
it.content.readUTF8LineNonEmpty { line -> emit(transform(line)) }
while (!it.rawContent.isClosedForRead) {
it.rawContent.readUTF8LineNonEmpty { line -> emit(transform(line)) }
}
}
}
Expand All @@ -24,8 +24,8 @@ fun <T> HttpStatement.readJsonTextStream(transform: suspend (line: String) -> T)
fun <T> HttpStatement.readJsonContentStream(transform: suspend (line: ByteReadChannel) -> T): Flow<T> = flow {
execute {
check(it.status.isSuccess()) { "Request failed with status: ${it.status}" }
while (!it.content.isClosedForRead) {
it.content.readUTF8LineNonEmpty { line -> emit(transform(ByteReadChannel(line.toByteArray()))) }
while (!it.rawContent.isClosedForRead) {
it.rawContent.readUTF8LineNonEmpty { line -> emit(transform(ByteReadChannel(line.toByteArray()))) }
}
}
}
Expand Down

0 comments on commit 9744741

Please sign in to comment.