Skip to main content
Module

x/hono/mod.ts>Context

Ultrafast web framework for the Edge
Extremely Popular
Go to Latest
class Context
import { Context } from "https://deno.land/x/hono@v3.0.1/mod.ts";

Constructors

new
Context(req: Request, options?: ContextOptions<E>)

Type Parameters

optional
E extends Env = any
optional
P extends string = any
optional
I extends Input = { }

Properties

private
_executionCtx: FetchEvent | ExecutionContext | undefined
private
_headers: Headers | undefined
private
_map: Record<string, unknown> | undefined
private
optional
_paramData: Record<string, string> | null
private
_preparedHeaders: Record<string, string> | undefined
private
_pretty: boolean
private
_prettySpace: number
private
optional
_req: HonoRequest<any, any>
private
_res: Response | undefined
private
_status: StatusCode
private
notFoundHandler: NotFoundHandler<E>
private
optional
rawRequest: Request | null
body: (
data: Data | null,
status?: StatusCode,
headers?: HeaderRecord,
) => Response
env: E["Bindings"]
error: Error | undefined
readonly
event: FetchEvent
readonly
executionCtx: ExecutionContext
finalized: boolean
get: <Key extends keyof E["Variables"] | keyof ContextVariableMap>(key: Key) => GetVariable<Key, E>
header: (
name: string,
value: string,
options?: { append?: boolean; },
) => void
html: (
html: string,
status?: StatusCode,
headers?: HeaderRecord,
) => Response
json: <T = object>(
object: T,
status?: StatusCode,
headers?: HeaderRecord,
) => Response
jsonT: <T = object>(
object: T,
status?: StatusCode,
headers?: HeaderRecord,
) => TypedResponse<T>
newResponse: (
data: Data | null,
status?: StatusCode,
headers?: HeaderRecord,
) => Response
notFound: () => Response | Promise<Response>
pretty: (prettyJSON: boolean, space?: number) => void
redirect: (location: string, status?: StatusCode) => Response
readonly
req: HonoRequest<P, I>
readonly
runtime: Runtime
set: <Key extends keyof E["Variables"] | keyof ContextVariableMap>(key: Key, value: GetVariable<Key, E>) => void
status: (status: StatusCode) => void
text: (
text: string,
status?: StatusCode,
headers?: HeaderRecord,
) => Response