DebugResponseSpec

The success response of a route, for the OpenAPI document: DebugRoute.response declares it. Its bodies, one for each content type, and its headers are in the order of the declarations.

Properties

Link copied to clipboard
var status: Int

The status of the response, 200 by default: a success status from 200 to 299, such as 201 for a route that creates an item. The document lists the response under it. A 204 or 205 response has no body, so it declares no schema and no content, and its handler answers with an empty body, such as DebugResponse.ok("", status = 204): a client such as OkHttp refuses a 204 with a body.

Functions

Link copied to clipboard
fun content(contentType: String, schema: String = "{}")

Adds a body of contentType that the JSON Schema schema describes. contentType is a media type, such as text/csv, or a media range with * as the subtype, for any image, or as both parts, for a body of any type. The default schema, {}, takes any body.

Link copied to clipboard
fun header(name: String, description: String, schema: String = STRING_SCHEMA)

Adds the response header name, with its description and the JSON Schema schema of its value, a string by default. Content-Type is not a header here: content declares it.