Skip to content

Class: StatusResult ​

A result with a status and headers: the HTTP adapters set them on the response and send the data with their responder; the CLI adapter outputs the data. Build it with Result.status().

Example ​

typescript
import {Controller, Result, type StatusResult} from 'lakutata/com/entrypoint'
import {POST} from 'lakutata/decorator/ctrl'

class OrderController extends Controller {
    //201 Created, with the location of the order
    @POST('/orders')
    public async create(): Promise<StatusResult> {
        return Result.status(201, {id: 42}, {Location: '/orders/42'})
    }
}

Extends ​

Constructors ​

Constructor ​

new StatusResult(status, payload?, headers?): StatusResult

Create a result with a status and headers.

Parameters ​

status ​

number

The HTTP status.

payload? ​

unknown

The data sent.

headers? ​

Record<string, string>

The response headers.

Returns ​

StatusResult

Overrides ​

ActionResult.constructor

Properties ​

headers ​

readonly headers: Record<string, string>


status ​

readonly status: number

Accessors ​

data ​

Get Signature ​

get data(): unknown

The data sent with the status.

Returns ​

unknown

Overrides ​

ActionResult.data

Released under the MIT License.