Skip to content

Commit

Permalink
KTOR-7276 Allow suspend function in ResponseSent hook
Browse files Browse the repository at this point in the history
  • Loading branch information
marychatte committed Nov 26, 2024
1 parent 418ff20 commit 7257901
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ktor-server/ktor-server-core/api/ktor-server-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public final class io/ktor/server/application/hooks/ResponseBodyReadyForSend$Con
public final class io/ktor/server/application/hooks/ResponseSent : io/ktor/server/application/Hook {
public static final field INSTANCE Lio/ktor/server/application/hooks/ResponseSent;
public synthetic fun install (Lio/ktor/server/application/ApplicationCallPipeline;Ljava/lang/Object;)V
public fun install (Lio/ktor/server/application/ApplicationCallPipeline;Lkotlin/jvm/functions/Function1;)V
public fun install (Lio/ktor/server/application/ApplicationCallPipeline;Lkotlin/jvm/functions/Function2;)V
}

public abstract interface class io/ktor/server/config/ApplicationConfig {
Expand Down
4 changes: 2 additions & 2 deletions ktor-server/ktor-server-core/api/ktor-server-core.klib.api
Original file line number Diff line number Diff line change
Expand Up @@ -1555,8 +1555,8 @@ final object io.ktor.server.application.hooks/ResponseBodyReadyForSend : io.ktor
}
}

final object io.ktor.server.application.hooks/ResponseSent : io.ktor.server.application/Hook<kotlin/Function1<io.ktor.server.application/ApplicationCall, kotlin/Unit>> { // io.ktor.server.application.hooks/ResponseSent|null[0]
final fun install(io.ktor.server.application/ApplicationCallPipeline, kotlin/Function1<io.ktor.server.application/ApplicationCall, kotlin/Unit>) // io.ktor.server.application.hooks/ResponseSent.install|install(io.ktor.server.application.ApplicationCallPipeline;kotlin.Function1<io.ktor.server.application.ApplicationCall,kotlin.Unit>){}[0]
final object io.ktor.server.application.hooks/ResponseSent : io.ktor.server.application/Hook<kotlin.coroutines/SuspendFunction1<io.ktor.server.application/ApplicationCall, kotlin/Unit>> { // io.ktor.server.application.hooks/ResponseSent|null[0]
final fun install(io.ktor.server.application/ApplicationCallPipeline, kotlin.coroutines/SuspendFunction1<io.ktor.server.application/ApplicationCall, kotlin/Unit>) // io.ktor.server.application.hooks/ResponseSent.install|install(io.ktor.server.application.ApplicationCallPipeline;kotlin.coroutines.SuspendFunction1<io.ktor.server.application.ApplicationCall,kotlin.Unit>){}[0]
}

final object io.ktor.server.engine/ConfigKeys { // io.ktor.server.engine/ConfigKeys|null[0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ public object ResponseBodyReadyForSend :
* A hook that is invoked when response was successfully sent to a client.
* Useful for cleaning up opened resources or finishing measurements.
*/
public object ResponseSent : Hook<(ApplicationCall) -> Unit> {
override fun install(pipeline: ApplicationCallPipeline, handler: (ApplicationCall) -> Unit) {
public object ResponseSent : Hook<suspend (ApplicationCall) -> Unit> {
override fun install(pipeline: ApplicationCallPipeline, handler: suspend (ApplicationCall) -> Unit) {
pipeline.sendPipeline.intercept(ApplicationSendPipeline.Engine) {
proceed()
handler(call)
Expand Down

0 comments on commit 7257901

Please sign in to comment.