Companion

expect object Companion
actual object Companion
actual object Companion

Functions

Link copied to clipboard
expect fun BufferedSource.asResponseBody(contentType: MediaType? = null, contentLength: Long = -1L): ResponseBody

Returns a new response body that transmits this source.

@JvmName(name = "create")
actual fun BufferedSource.asResponseBody(contentType: MediaType?, contentLength: Long): ResponseBody
actual fun BufferedSource.asResponseBody(contentType: MediaType?, contentLength: Long): ResponseBody
Link copied to clipboard
fun create(contentType: MediaType?, content: ByteArray): ResponseBody
fun create(contentType: MediaType?, content: String): ResponseBody
fun create(contentType: MediaType?, content: ByteString): ResponseBody
fun create(contentType: MediaType?, contentLength: Long, content: BufferedSource): ResponseBody
Link copied to clipboard
expect fun ByteArray.toResponseBody(contentType: MediaType? = null): ResponseBody

Returns a new response body that transmits this byte array.

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.

expect fun ByteString.toResponseBody(contentType: MediaType? = null): ResponseBody

Returns a new response body that transmits this byte string.

@JvmName(name = "create")
actual fun ByteArray.toResponseBody(contentType: MediaType?): ResponseBody
@JvmName(name = "create")
actual fun String.toResponseBody(contentType: MediaType?): ResponseBody
@JvmName(name = "create")
actual fun ByteString.toResponseBody(contentType: MediaType?): ResponseBody
actual fun ByteArray.toResponseBody(contentType: MediaType?): ResponseBody
actual fun String.toResponseBody(contentType: MediaType?): ResponseBody
actual fun ByteString.toResponseBody(contentType: MediaType?): ResponseBody