Skip to content

//okhttp/okhttp3/ResponseBody/Companion

Companion

[common]\ expect object Companion

[jvm, nonJvm]\ actual object Companion

Functions

Name Summary
asResponseBody [common]
expect fun BufferedSource.asResponseBody(contentType: MediaType? = null, contentLength: Long = -1L): ResponseBody
Returns a new response body that transmits this source.
[jvm, nonJvm]
[jvm]
@JvmStatic
@JvmName(name = "create")
actual fun BufferedSource.asResponseBody(contentType: MediaType?, contentLength: Long): ResponseBody
[nonJvm]
actual fun BufferedSource.asResponseBody(contentType: MediaType?, contentLength: Long): ResponseBody
toResponseBody [common]
expect fun ByteArray.toResponseBody(contentType: MediaType? = null): ResponseBody
Returns a new response body that transmits this byte array.
[jvm, nonJvm]
[jvm]
@JvmStatic
@JvmName(name = "create")
actual fun ByteArray.toResponseBody(contentType: MediaType?): ResponseBody
[nonJvm]
actual fun ByteArray.toResponseBody(contentType: MediaType?): ResponseBody
[jvm]
@JvmStatic
@JvmName(name = "create")
actual fun String.toResponseBody(contentType: MediaType?): ResponseBody
[nonJvm]
actual fun String.toResponseBody(contentType: MediaType?): ResponseBody
[jvm]
@JvmStatic
@JvmName(name = "create")
actual fun ByteString.toResponseBody(contentType: MediaType?): ResponseBody
[nonJvm]
actual fun ByteString.toResponseBody(contentType: MediaType?): ResponseBody
[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.
[common]
expect fun ByteString.toResponseBody(contentType: MediaType? = null): ResponseBody
Returns a new response body that transmits this byte string.