bytes

suspend fun ContentSource.bytes(limit: Int? = null): ByteArray(source)

Convenience method to convert a body's content into a raw byte array.

Parameters

limit

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


fun Body.Companion.bytes(bytes: ByteArray, contentType: String = "application/octet-stream"): Body(source)

Deprecated

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

Replace with

bodyOf(bytes, contentType)