respondText

abstract fun respondText(scope: CoroutineScope, text: String, contentType: (ContentTypes) -> ContentType?): Job

向客户端发送一段文本作为响应体。

Parameters

scope

执行此异步操作的协程作用域。

text

要发送的文本内容。

contentType

(可选)一个 lambda,用于指定响应的 Content-Type。 默认为 text/plain。例如:{ it.getTextHtml() }