ktor-http / io.ktor.http.content / WriterContent

WriterContent

class WriterContent : WriteChannelContent

Represents a content that is produced by body function

Constructors

<init>

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

Represents a content that is produced by body function

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