Skip to content

Commit

Permalink
Fix api
Browse files Browse the repository at this point in the history
  • Loading branch information
marychatte committed Nov 8, 2024
1 parent 8b75131 commit f7429d9
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,14 @@ private fun Route.processSSEWithoutSerialization(
) = processSSE(serialize, handler)

private fun Route.processSSEWithSerialization(
serialize: ((TypeInfo, Any) -> String)?,
serialize: ((TypeInfo, Any) -> String),
handler: suspend ServerSSESessionWithSerialization.() -> Unit
) {
val sessionHandler: suspend ServerSSESession.() -> Unit = {
if (this is ServerSSESessionWithSerialization) {
handler()
} else {
throw IllegalStateException("ServerSSESessionWithSerialization is required.")
check(this is ServerSSESessionWithSerialization) {
"Impossible state. Please report this bug: https://youtrack.jetbrains.com/newIssue?project=KTOR"
}
handler()
}
processSSE(serialize, sessionHandler)
}
Expand Down

0 comments on commit f7429d9

Please sign in to comment.