//okhttp/okhttp3/ResponseBody/Companion/toResponseBody
toResponseBody¶
[common]\ expect fun String.toResponseBody(contentType: MediaType? = null): ResponseBody
Returns a new response body that transmits this string. If contentType is non-null and has a charset other than utf-8 the behaviour differs by platform.
On the JVM the encoding will be used instead of utf-8.
On non JVM platforms, this method will fail for encodings other than utf-8.
[jvm, nonJvm]\ [jvm]\
@JvmName(name = "create")
actual fun String.toResponseBody(contentType: MediaType?): ResponseBody
[nonJvm]\ actual fun String.toResponseBody(contentType: MediaType?): ResponseBody
[jvm]\
@JvmName(name = "create")
actual fun ByteArray.toResponseBody(contentType: MediaType?): ResponseBody
[nonJvm]\ actual fun ByteArray.toResponseBody(contentType: MediaType?): ResponseBody
[jvm]\
@JvmName(name = "create")
actual fun ByteString.toResponseBody(contentType: MediaType?): ResponseBody
[nonJvm]\ actual fun ByteString.toResponseBody(contentType: MediaType?): ResponseBody
[common]\ expect fun ByteArray.toResponseBody(contentType: MediaType? = null): ResponseBody
Returns a new response body that transmits this byte array.
[common]\ expect fun ByteString.toResponseBody(contentType: MediaType? = null): ResponseBody
Returns a new response body that transmits this byte string.