Skip to main content
Module

x/nhttp/index.ts>HttpResponse

An Simple web-framework for Deno and Friends.
Go to Latest
class HttpResponse
import { HttpResponse } from "https://deno.land/x/nhttp@1.2.23/index.ts";

Constructors

new
HttpResponse(send: (body?: TSendBody) => void, init: ResInit)

Index Signatures

[k: string | symbol]: TRet

Properties

params: TObject

params as json object for response.render.

render: (
fileOrElem: TRet,
params?: TObject,
...args: TRet,
) => Promise<void>

render requires app.engine configs

statusCode: number

set/get statusCode

Methods

attachment(filename?: string)

attachment. create header content-disposition

clearCookie(name: string, opts?: Cookie)

clear cookie

getHeader(key: string)

getHeader

header(key: string, value: string | string[]): this

set header or get header

header(key: string): string
header(key: TObject): this
header(): RetHeaders
html(html: string | Uint8Array)

shorthand for send html body

json(body: TObject)

shorthand for send json body

redirect(url: string, status?: number)

redirect url

sendStatus(code: number)

sendStatus

setHeader(key: string, value: string | string[])

setHeader

status(code: number): this

set status or get status

status(): number
type(contentType: string)

shorthand for content-type headers

[deno_inspect](inspect: TRet, opts: TRet)
[node_inspect](
depth: number,
opts: TRet,
inspect: TRet,
)