redirectTo

inline suspend fun ApplicationCall.redirectTo(permanent: Boolean = false, block: suspend () -> String)

Redirects the client to the URL produced by block.

This is an extension function on ApplicationCall. The block is a suspending lambda; a non-suspending lambda is also accepted since () -> String is a subtype of suspend () -> String.

Parameters

permanent

whether to issue a 301 (permanent) redirect; defaults to false (302 temporary)

block

a lambda that returns the redirect target URL as a String


inline suspend fun RoutingContext.redirectTo(permanent: Boolean = false, block: suspend () -> String)

Redirects the client to the URL produced by block.

This is an extension function on RoutingContext that delegates to ApplicationCall.redirectTo.

Parameters

permanent

whether to issue a 301 (permanent) redirect; defaults to false (302 temporary)

block

a lambda that returns the redirect target URL as a String