AbstractResponseDefinitionBuilder

abstract class AbstractResponseDefinitionBuilder<P, T>(var delay: Duration = Duration.ZERO)(source)

Represents a base abstraction for defining the attributes of an HTTP response in the context of request-to-response mappings. This class allows customization of the HTTP status code and headers and provides a mechanism for building concrete response definitions.

Author

Konstantin Pavlov

Parameters

P

The type of the request body. This determines the input type for which the response is being defined.

T

The type of the response data, which is returned to the client.

Inheritors

Constructors

Link copied to clipboard
constructor(delay: Duration = Duration.ZERO)

Types

Link copied to clipboard
inner class HeadersConfigurer

Provides the headers { } lambda and headers += pair-shorthand syntax for configuring response headers within a AbstractResponseDefinitionBuilder.

Properties

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

Functions

Link copied to clipboard
fun addHeader(name: String, value: String)

Adds a single response header.

Link copied to clipboard
fun delayMillis(millis: Long)

Sets a delay for the response in milliseconds.

Link copied to clipboard
fun httpStatus(status: Int)