ResponseDefinition

open class ResponseDefinition<T>(contentType: ContentType = ContentType.Application.Json, val body: T? = null, httpStatus: HttpStatusCode = HttpStatusCode.OK, headers: ResponseHeaders.() -> Unit? = null, delay: Duration, formatter: HttpFormatter) : AbstractResponseDefinition<T> (source)

Represents a concrete implementation of an HTTP response definition with a specific response body. This class builds on the AbstractResponseDefinition to provide additional configuration and behavior.

Author

Konstantin Pavlov

Type Parameters

T

The type of the response body.

Constructors

Link copied to clipboard
constructor(contentType: ContentType = ContentType.Application.Json, body: T? = null, httpStatus: HttpStatusCode = HttpStatusCode.OK, headers: ResponseHeaders.() -> Unit? = null, delay: Duration, formatter: HttpFormatter)

Properties

Link copied to clipboard
val body: T?

The body of the response, which can be null.

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.

Functions

Link copied to clipboard

Returns the HTTP status code as an integer.