Part

One section inside the parent Multipart request body.

Properties

Link copied to clipboard
Link copied to clipboard
open override val contentLength: Long?

The size, in bytes, of the content, if known / provided ahead of time (or null otherwise).

Link copied to clipboard
abstract val contentType: String?

The content type that describes the bytes owned by this body.

Link copied to clipboard
abstract val extras: Multipart.Extras?
Link copied to clipboard
abstract val headers: Map<String, List<String>>
Link copied to clipboard
abstract val name: String?

Functions

Link copied to clipboard
suspend fun ContentSource.bytes(limit: Int? = null): ByteArray

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

Link copied to clipboard
abstract fun close()
Link copied to clipboard
abstract suspend fun consumeContent(): ByteSource

Open an async stream up that consumes the content of this body.

Link copied to clipboard

Convert this byte source into an InputStream.

Link copied to clipboard
suspend fun ContentSource.text(charset: Charset = contentType.parseCharsetFromContentType(), limit: Int? = null): String

Convenience method to convert a body's content into a UTF-8 string.