StreamingResponseDefinitionBuilder

open class StreamingResponseDefinitionBuilder<P : Any, T>(val request: CapturedRequest<P>, var flow: <Error class: unknown class><T>? = null, var chunks: MutableList<T> = mutableListOf(), var delayBetweenChunks: <Error class: unknown class> = Duration.ZERO, httpStatus: <Error class: unknown class> = HttpStatusCode.OK, headers: MutableList<<Error class: unknown class><String, String>> = mutableListOf()) : AbstractResponseDefinitionBuilder<P, T>

A builder for constructing streaming response definitions.

This class is responsible for building instances of StreamResponseDefinition, which define responses capable of streaming data either as chunks or via a flow.

Parameters

P

The type of the request body.

T

The type of data being streamed.

Constructors

Link copied to clipboard
constructor(request: CapturedRequest<P>, flow: <Error class: unknown class><T>? = null, chunks: MutableList<T> = mutableListOf(), delayBetweenChunks: <Error class: unknown class> = Duration.ZERO, httpStatus: <Error class: unknown class> = HttpStatusCode.OK, headers: MutableList<<Error class: unknown class><String, String>> = mutableListOf())

Properties

Link copied to clipboard

A list of data chunks to be sent as part of the stream, if flow is not provided.

Link copied to clipboard
var delay: <Error class: unknown class>
Link copied to clipboard
var delayBetweenChunks: <Error class: unknown class>
Link copied to clipboard
var flow: <Error class: unknown class><T>?

A Flow representing streaming data content.

Link copied to clipboard
val headers: MutableList<<Error class: unknown class><String, String>>

A mutable list of header key-value pairs to be included in the response.

Link copied to clipboard
var httpStatus: <Error class: unknown class>

The HTTP status code to be associated with the response.

Link copied to clipboard

Functions

Link copied to clipboard
open override fun build(): StreamResponseDefinition<P, T>

Builds an instance of StreamResponseDefinition.

Link copied to clipboard
fun delayMillis(millis: Long)

Sets a delay for the response in milliseconds.

Link copied to clipboard
fun headers(block: <Error class: unknown class>.() -> Unit)

Configures additional headers for the response using the specified lambda block.

Link copied to clipboard
fun httpStatus(status: Int)