respondWith

inline suspend fun ApplicationCall.respondWith(contentType: ContentType = Text.Html, block: () -> String)

Responds to the client with text content produced by block.

This is an extension function on ApplicationCall.

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: () -> 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