text

suspend fun ContentSource.text(charset: Charset = contentType.parseCharsetFromContentType(), limit: Int? = null): String(source)

Convenience method to convert a body's content into a UTF-8 string.

Parameters

limit

If set and the size of the body is larger than it, throw an exception.


fun Body.Companion.text(text: String, contentType: String = "text/plain"): Body(source)

Deprecated

Use `bodyOf` method instead, for consistency with frontend APIs

Replace with

bodyOf(text, contentType)