ResponseDefinitionBuilder

Builder for constructing a definition of an HTTP response with configurable attributes.

Type Parameters

P

The type of the request body.

T

The type of the response body.

Properties

Link copied to clipboard
var body: T?

The body of the response. Can be null.

Link copied to clipboard

Optional MIME type of the response. Defaults to null if not specified.

Link copied to clipboard
Link copied to clipboard

Entry point for header configuration. Supports two syntaxes:

Link copied to clipboard

The HTTP status code of the response.

Link copied to clipboard
open override var httpStatusCode: Int

The HTTP status code of the response as an Int, defaulting to HttpStatusCode.OK.value (200).

Link copied to clipboard

The CapturedRequest being processed.

Functions

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

Adds a single response header.

Link copied to clipboard

Sets the response body and returns this builder for chaining.

Link copied to clipboard

Adds a response header and returns this builder for chaining.

Link copied to clipboard

Sets the HTTP status code and returns this builder for chaining.