Skip to main content
Module

x/kyuko/mod.ts>KyukoResponse

Fast and easy http framework for Deno Deploy 🦕
Latest
interface KyukoResponse
import { type KyukoResponse } from "https://deno.land/x/kyuko@v0.6.3/mod.ts";

The response object that is handled in Kyuko applications. Responsible for storing information about the response to the request, as well as sending the response via the send() and redirect() methods.

Note that send() or redirect() must be called or else the request will hang.

Properties

body: BodyInit | null
statusCode: number | undefined
statusText: string | undefined
headers: Headers

Methods

status(status: Status): KyukoResponse

Sets the status code to status, and returns this.

redirect(address: string, status?: number): void

Redirects the request to a new address. The address can be either a relative url path, or a full url. The optional status parameter can be used to set a custom status code. Otherwise overrides the current res.statusCode with 302.

json(object: any): void

Sends a proper json response to the original request. The json is stringify'd from the input JavaScript object.

send(body?: BodyInit): void

Sends a response to the original request that instantiated this object. The response is built using the public attributes of this object, which should've been set by the user beforehand.

wasSent(): boolean