ChannelContent

abstract class ChannelContent : HttpBody

Variant of an HttpBody with a streaming payload read from an SdkByteReadChannel

Constructors

Link copied to clipboard
constructor()

Inherited properties

Link copied to clipboard
open val contentLength: Long? = null

Specifies the length of this HttpBody content If null it is assumed to be a streaming source using e.g. Transfer-Encoding: Chunked

Link copied to clipboard
open val isDuplex: Boolean = false

Flag indicating that this request body should be handled as a duplex stream by the underlying engine.

Link copied to clipboard
open val isOneShot: Boolean = true

Flag indicating the body can be consumed only once

Functions

Link copied to clipboard

Provides SdkByteReadChannel that will be sent to peer. Replayable streams (HttpBody.isOneShot = false) MUST provide a fresh channel every time readFrom is invoked.

Inherited functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
suspend fun HttpBody.readAll(): ByteArray?

Consume the HttpBody and pull the entire contents into memory as a ByteArray. Only do this if you are sure the contents fit in-memory as this will read the entire contents of a streaming variant.

Link copied to clipboard

Convert an HttpBody variant to the corresponding ByteStream variant or null if empty.