Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KTOR-7276 Allow suspend function in ResponseSent hook #4508

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
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