Libraries v5.2.0
    Preparing search index...

    Class StatusCodeResult<TStatus>

    Responds with a bare HTTP status code and no body. Created by ActionResult.status().

    Type Parameters

    • TStatus extends number = number

    Hierarchy (View Summary)

    Index
    headers: Record<string, string>
    status: TStatus
    • Parameters

      Returns Promise<void>

    • 202 Accepted — serializes value using content negotiation.

      Type Parameters

      • T

      Parameters

      • body: T
      • Optionalheaders: Record<string, string>

      Returns JsonResult<202, T>

    • 400 Bad Request — serializes value as JSON.

      Type Parameters

      • T

      Parameters

      • body: T
      • Optionalheaders: Record<string, string>

      Returns JsonResult<400, T>

    • 409 Conflict — serializes value as JSON.

      Type Parameters

      • T

      Parameters

      • body: T
      • Optionalheaders: Record<string, string>

      Returns JsonResult<409, T>

    • Arbitrary string body with an explicit content type.

      Parameters

      • body: string
      • contentType: string
      • status: number = 200

      Returns ContentResult

    • 201 Created — serializes value using content negotiation.

      Type Parameters

      • T

      Parameters

      • body: T
      • Optionallocation: string
      • Optionalheaders: Record<string, string>

      Returns JsonResult<201, T>

    • Send a file buffer as a download attachment.

      Parameters

      • content: Uint8Array<ArrayBufferLike> | Buffer<ArrayBufferLike>
      • fileName: string
      • contentType: string = 'application/octet-stream'

      Returns FileResult

    • 403 Forbidden — serializes value as JSON.

      Type Parameters

      • T

      Parameters

      • body: T
      • Optionalheaders: Record<string, string>

      Returns JsonResult<403, T>

    • Explicit JSON response with a specific status code. Use the named factories (ok, notFound, etc.) for common codes. This overload is an escape hatch for uncommon status codes.

      Type Parameters

      • T

      Parameters

      • body: T

      Returns JsonResult<200, T>

    • Explicit JSON response with a specific status code. Use the named factories (ok, notFound, etc.) for common codes. This overload is an escape hatch for uncommon status codes.

      Type Parameters

      • S extends number
      • T

      Parameters

      • body: T
      • status: S
      • Optionalheaders: Record<string, string>

      Returns JsonResult<S, T>

    • 404 Not Found — serializes value as JSON.

      Type Parameters

      • T

      Parameters

      • body: T
      • Optionalheaders: Record<string, string>

      Returns JsonResult<404, T>

    • 200 OK — serializes value using content negotiation.

      Type Parameters

      • T

      Parameters

      • body: T
      • Optionalheaders: Record<string, string>

      Returns JsonResult<200, T>

    • Execute a raw Node request/response handler.

      Use this for integrations that already know how to write to http.ServerResponse, such as webhook libraries or compatibility adapters. The callback is responsible for ending the response when it writes a body.

      Parameters

      Returns RawResult

    • Temporary (302) or permanent (301) redirect.

      Parameters

      • url: string
      • permanent: boolean = false

      Returns RedirectResult

    • Bare status code with no body.

      Type Parameters

      • S extends number

      Parameters

      • status: S
      • Optionalheaders: Record<string, string>

      Returns StatusCodeResult<S>

    • Pipe a Readable stream to the response.

      Parameters

      • readable: Readable
      • contentType: string
      • OptionalfileName: string

      Returns StreamResult

    • 401 Unauthorized — serializes value as JSON.

      Type Parameters

      • T

      Parameters

      • body: T
      • Optionalheaders: Record<string, string>

      Returns JsonResult<401, T>