ktor-http / io.ktor.http.content / ChannelWriterContent

ChannelWriterContent

class ChannelWriterContent : WriteChannelContent

OutgoingContent to respond with ByteWriteChannel. The stream would be automatically closed after body finish.

Constructors

<init>

ChannelWriterContent(body: suspend ByteWriteChannel.() -> Unit, contentType: ContentType?, status: HttpStatusCode? = null)

OutgoingContent to respond with ByteWriteChannel. The stream would be automatically closed after body finish.

Properties

contentType

val contentType: ContentType?

Specifies ContentType for this resource.

status

val status: HttpStatusCode?

Status code to set when sending this content

Functions

writeTo

suspend fun writeTo(channel: ByteWriteChannel): Unit

Receives channel provided by the engine and writes all data to it

Extension Properties

caching

var OutgoingContent.caching: CachingOptions?

Gets or sets CacheControl instance as an extension property on this content

versions

var OutgoingContent.versions: List<Version>

Gets or sets list of Version instances as an extension property on this content