rawBody

fun rawBody(name: String = "bytes", mediaType: MediaType? = null): RawBody(source)

Creates a raw body that uses an identity codec and optional media type.

Return

a RawBody that passes bytes through unchanged.

Parameters

name

friendly name used in error messages when encoding/decoding fails.

mediaType

media type advertised for the body, if any.


fun rawBody(codec: ByteArrayCodec<ByteArray>, mediaType: MediaType? = null, name: String = "bytes"): RawBody(source)

Creates a raw body using the provided codec and optional mediaType.

Return

a RawBody that delegates encoding/decoding to codec.

Parameters

codec

encoder/decoder that understands how to transform the payload bytes.

mediaType

media type advertised for the body, if any.