Skip to main content
Module

x/nhttp/mod.ts>HttpResponse

An Simple Http Route framework for Deno and Friends. So Hot 🚀
Go to Latest
class HttpResponse
import { HttpResponse } from "https://deno.land/x/nhttp@1.1.13/mod.ts";

Constructors

new
HttpResponse(_send: TResp)

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 | Response>

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
json(body: TObject)

shorthand for send json body

redirect(url: string, status?: number)

redirect url

send(body?: TSendBody)

send response body

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