AbstractResponseDefinition

abstract class AbstractResponseDefinition<T>(val contentType: ContentType, val httpStatus: HttpStatusCode = HttpStatusCode.OK, val headers: ResponseHeaders.() -> Unit? = null, val delay: Duration = Duration.ZERO)(source)

Represents the base definition of an HTTP response in a mapping between a request and its corresponding response. Provides the required attributes and behavior for configuring HTTP responses, including status code, headers, and content type. This class serves as the foundation for more specialized response definitions.

Author

Konstantin Pavlov

Type Parameters

T

The type of the response data.

Inheritors

Constructors

Link copied to clipboard
constructor(contentType: ContentType, httpStatus: HttpStatusCode = HttpStatusCode.OK, headers: ResponseHeaders.() -> Unit? = null, delay: Duration = Duration.ZERO)

Properties

Link copied to clipboard

The MIME type of the response content.

Link copied to clipboard
open val delay: Duration

A delay applied before sending the response. Defaults to Duration.ZERO.

Link copied to clipboard

A lambda that configures the response headers. Defaults to null.

Link copied to clipboard

The HTTP status code of the response. Defaults to HttpStatusCode.OK.