Skip to main content
Module

x/texa/src/structure/Response.ts>Response

A Deno web framework inspired by Oak and Express. Built-in support for WebSockets, middleware and routing.
Latest
class Response
import { Response } from "https://deno.land/x/texa@0.8.1/src/structure/Response.ts";

A response object.

Constructors

new
Response(pair: Pair)

Initiate a new response object.

Properties

content: string

The body content.

readonly
headers: ResponseHeaders

The headers to send back.

statusCode: Status

The status code to respond with.

readonly
WRITABLE: boolean

Methods

delete(key: string): this

Alias: .headers.delete(key: string)

end(body?: string): Promise<this>

Send and end the response.

file(path: string): this

Send file contents in response. File contents are loaded in .end().

get(key: string): HeaderValue | void

Alias: .headers.get(key: string)

has(key: string): boolean

Alias: .headers.has(key: string)

json(data: any): Promise<this>

Send a json response and end the response.

set(key: string, value: HeaderValue): this

Alias: .headers.set(key: string, value: HeaderValue)

status(code: Status): this

Set the status code to respond with.

type(type: string): this

Set the Content-Type response header.

write(chunk?: string): this

Write some data to the body.