OutputStreamContent

class OutputStreamContent(body: suspend OutputStream.() -> Unit, contentType: ContentType, status: HttpStatusCode?, contentLength: Long?) : OutgoingContent.WriteChannelContent

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

Constructors

Link copied to clipboard
fun OutputStreamContent(body: suspend OutputStream.() -> Unit, contentType: ContentType, status: HttpStatusCode? = null, contentLength: Long? = null)

Functions

Link copied to clipboard
open fun <T : Any> getProperty(key: AttributeKey<T>): T?

Gets an extension property for this content

Link copied to clipboard
open fun <T : Any> setProperty(key: AttributeKey<T>, value: T?)

Sets an extension property for this content

Link copied to clipboard
open fun trailers(): Headers?

Trailers to set when sending this content, will be ignored if request is not in HTTP2 mode

Link copied to clipboard
open suspend override fun writeTo(channel: ByteWriteChannel)

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

Properties

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

Specifies content length in bytes for this resource.

Link copied to clipboard
open override val contentType: ContentType

Specifies ContentType for this resource.

Link copied to clipboard
open val headers: Headers

Headers to set when sending this content

Link copied to clipboard
open override val status: HttpStatusCode? = null

Status code to set when sending this content