Streaming Response Definition Builder
open class StreamingResponseDefinitionBuilder<P : Any, T>(val request: CapturedRequest<P>, var flow: Flow<T>? = null, var chunks: MutableList<T> = mutableListOf(), var delayBetweenChunks: Duration = Duration.ZERO, httpStatus: HttpStatusCode = HttpStatusCode.OK, val chunkContentType: ContentType? = null, formatter: HttpFormatter) : AbstractResponseDefinitionBuilder<P, T> (source)
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: Flow<T>? = null, chunks: MutableList<T> = mutableListOf(), delayBetweenChunks: Duration = Duration.ZERO, httpStatus: HttpStatusCode = HttpStatusCode.OK, chunkContentType: ContentType? = null, formatter: HttpFormatter)
Properties
Link copied to clipboard
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
Link copied to clipboard
Entry point for header configuration. Supports two syntaxes:
Link copied to clipboard
The HTTP status code to be associated with the response.
Link copied to clipboard
Link copied to clipboard
The CapturedRequest being processed.
Functions
Link copied to clipboard
Builds an instance of StreamResponseDefinition.
Link copied to clipboard
Sets a delay for the response in milliseconds.
Link copied to clipboard