ResponseDefinition

open class ResponseDefinition<P, T>(contentType: <Error class: unknown class> = ContentType.Application.Json, val body: T? = null, httpStatus: <Error class: unknown class> = HttpStatusCode.OK, headers: <Error class: unknown class>.() -> Unit? = null, headerList: List<<Error class: unknown class><String, String>> = emptyList<Pair<String, String>>(), delay: <Error class: unknown class>) : AbstractResponseDefinition<T>

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.

Parameters

P

The type of the request body.

T

The type of the response body.

Constructors

Link copied to clipboard
constructor(contentType: <Error class: unknown class> = ContentType.Application.Json, body: T? = null, httpStatus: <Error class: unknown class> = HttpStatusCode.OK, headers: <Error class: unknown class>.() -> Unit? = null, headerList: List<<Error class: unknown class><String, String>> = emptyList<Pair<String, String>>(), delay: <Error class: unknown class>)

Properties

Link copied to clipboard
val body: T? = null

The body of the response, which can be null.

Link copied to clipboard
val contentType: <Error class: unknown class>?

The MIME type of the response content. Defaults to null.

Link copied to clipboard
open val delay: <Error class: unknown class>
Link copied to clipboard
val headerList: List<<Error class: unknown class><String, String>>

A list of header key-value pairs to populate the response headers. Defaults to an empty list.

Link copied to clipboard
val headers: <Error class: unknown class>.() -> Unit?

A lambda function for configuring the response headers. Defaults to null.

Link copied to clipboard
val httpStatus: <Error class: unknown class>

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