respondWith
inline suspend fun ApplicationCall.respondWith(contentType: ContentType = Text.Html, block: suspend () -> String)
Responds to the client with text content 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
contentType
the content type of the response; defaults to ContentType.Text.Html
block
a lambda that returns the response body as a String
inline suspend fun RoutingContext.respondWith(contentType: ContentType = Text.Html, block: suspend () -> String)
Responds to the client with text content produced by block.
This is an extension function on RoutingContext that delegates to ApplicationCall.respondWith.
Parameters
contentType
the content type of the response; defaults to ContentType.Text.Html
block
a lambda that returns the response body as a String