bodyText

fun bodyText(fallbackCharset: Charset = Charsets.UTF_8): String?

Utility method to read the body as a String.

If the content-encoding header is gzip, then the body will be unzipped.

If the content-type header specifies a charset, then it will be used to convert the body to a String. If no charset is present in the header, then a fallbackCharset can be specified to read the body, otherwise it will default to UTF-8

Parameters

fallbackCharset

optional charset to read the bytes; default is Charsets.UTF_8