respondsError

open infix fun <T : Any> respondsError(block: suspend ResponseDefinitionBuilder<P, T>.() -> Unit)(source)

Specifies an error response for a given request scenario. This allows defining the characteristics of an erroneous response, such as the HTTP status, response body, headers, delay, and more.

Parameters

block

A lambda function applied to a ResponseDefinitionBuilder, used to configure the error response properties such as the body, status, headers, and other attributes.

Type Parameters

T

The type of the response body for the error response.


open fun <T : Any> respondsError(responseType: KClass<T>, block: suspend ResponseDefinitionBuilder<P, T>.() -> Unit)(source)


open infix fun <R : Any> respondsError(block: Consumer<ResponseDefinitionBuilder<P, R>>)(source)

Specifies an erroneous response for a completions request.

This method enables defining the error response using a Consumer-like approach for interoperability with Java.

Parameters

block

a Consumer that configures the error response by applying specifications to an instance of the ResponseDefinitionBuilder. The ResponseDefinitionBuilder allows setting attributes such as the HTTP status, response body, headers, and more.

Type Parameters

R

The type of the response body for the error response.