Skip to main content
Module

x/nhttp/index.ts>RequestEvent

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

Constructors

new
RequestEvent(request: Request)

Type Parameters

optional
O extends TObject = TObject

Index Signatures

[k: string | symbol]: TRet

Properties

body: TObject

body as json object.

cookies: TObject

get cookies from request.

file: TObject

file.

headers: Headers

headers.

readonly
info: TInfo<O>

lookup Object info like conn / env / context. requires showInfo flags.

method: string

Http request method.

readonly
newRequest: Request

clone new Request.

originalUrl: string

originalUrl

params: TObject

params as json object.

path: string

lookup path

query: TObject

lookup query parameter

requestEvent: () => RequestEvent

invoke self RequestEvent

respondWith: (r: Response | PromiseLike<Response>) => void | Promise<void>

The method to be used to respond to the event. The response needs to either be an instance of Response or a promise that resolves with an instance of Response.

readonly
response: HttpResponse

response as HttpResponse

readonly
responseInit: ResponseInit

Lookup responseInit.

readonly
route: MatchRoute

lookup self route

undefined: () => void

force returning undefined without 408.

url: string

url

waitUntil: (promise: Promise<TRet>) => unknown

This method tells the event dispatcher that work is ongoing. It can also be used to detect whether that work was successful.

Methods

send(body?: TSendBody, lose?: number): void | Promise<void>

send body

[deno_inspect](inspect: TRet, opts: TRet)
[node_inspect](
depth: number,
opts: TRet,
inspect: TRet,
)
interface RequestEvent
implements [NHTTP.RequestEvent]
Re-export
import { type RequestEvent } from "https://deno.land/x/nhttp@1.3.22/index.ts";

Properties

log: (data: TRet) => void

send data to log. requires logger middlewares