response

fun response(description: String, schema: String? = null, declare: DebugResponseSpec.() -> Unit = {})

Describes the route's success response for the OpenAPI document: its description, and the JSON Schema schema of its application/json body, or none. declare adds a body of another content type, such as the bytes of DebugResponse.bytes, and the response's headers:

response("The image, as it is stored.") {
content("image/png")
header("Content-Disposition", "attachment, for a download.")
}

The response is 200 unless DebugResponseSpec.status names another success status, such as response("The new item.", schema) { status = 201 }. The handler still answers it, such as with DebugResponse.ok(json, status = 201). Nothing compares the declared status with the status that the handler answers, so use one constant for both, and check the status in a unit test that calls tab.handle().