respondsWithStream

infix fun <T : Any> respondsWithStream(block: suspend StreamingResponseDefinitionBuilder<P, T>.() -> Unit)(source)

Associates the current RequestSpecification with a streaming response definition. This method is part of a fluent API for defining mappings between requests and streaming responses.

The block lambda is a suspend function, so it may call suspend APIs such as dev.mokksy.mokksy.request.CapturedRequest.body without blocking.

Parameters

P

The type of the request payload.

T

The type of the elements in the streaming response data.

block

A suspend lambda applied to a StreamingResponseDefinitionBuilder, used to configure the streaming response definition.


fun <T : Any> respondsWithStream(responseType: KClass<T>, block: suspend StreamingResponseDefinitionBuilder<P, T>.() -> Unit)(source)

Associates the current RequestSpecification with a streaming response definition.

This overload accepts an explicit responseType class token to help the compiler infer the type parameter T when it cannot be determined from the block alone (type-witness pattern). The responseType value itself is not used at runtime.

Parameters

T

The type of elements in the streaming response.

responseType

A KClass token for T, used only for type inference at the call site.

block

A suspend lambda applied to a StreamingResponseDefinitionBuilder, used to configure the streaming response definition.