diff --git a/src/context.ts b/src/context.ts index 709196f98..9b9dfa782 100644 --- a/src/context.ts +++ b/src/context.ts @@ -114,6 +114,9 @@ export class Context< req: HonoRequest
/**
* `.env` can get bindings (environment variables, secrets, KV namespaces, D1 database, R2 bucket etc.) in Cloudflare Workers.
+ *
+ * @see {@link https://hono.dev/api/context#env}
+ *
* @example
* ```ts
* // Environment object for Cloudflare Workers
@@ -121,13 +124,15 @@ export class Context<
* const counter = c.env.COUNTER
* })
* ```
- * @see https://hono.dev/api/context#env
*/
env: E['Bindings'] = {}
private _var: E['Variables'] = {}
finalized: boolean = false
/**
* `.error` can get the error object from the middleware if the Handler throws an error.
+ *
+ * @see {@link https://hono.dev/api/context#error}
+ *
* @example
* ```ts
* app.use('*', async (c, next) => {
@@ -137,7 +142,6 @@ export class Context<
* }
* })
* ```
- * @see https://hono.dev/api/context#error
*/
error: Error | undefined = undefined
@@ -163,7 +167,7 @@ export class Context<
}
/**
- * @see https://hono.dev/api/context#event
+ * @see {@link https://hono.dev/api/context#event}
*/
get event(): FetchEventLike {
if (this.#executionCtx && 'respondWith' in this.#executionCtx) {
@@ -174,7 +178,7 @@ export class Context<
}
/**
- * @see https://hono.dev/api/context#executionctx
+ * @see {@link https://hono.dev/api/context#executionctx}
*/
get executionCtx(): ExecutionContext {
if (this.#executionCtx) {
@@ -185,7 +189,7 @@ export class Context<
}
/**
- * @see https://hono.dev/api/context#res
+ * @see {@link https://hono.dev/api/context#res}
*/
get res(): Response {
this.#isFresh = false
@@ -214,13 +218,15 @@ export class Context<
/**
* `.render()` can create a response within a layout.
+ *
+ * @see {@link https://hono.dev/api/context#render-setrenderer}
+ *
* @example
* ```ts
* app.get('/', (c) => {
* return c.render('Hello!')
* })
* ```
- * @see https://hono.dev/api/context#render-setrenderer
*/
render: Renderer = (...args) => this.renderer(...args)
@@ -236,6 +242,9 @@ export class Context<
/**
* `.setRenderer()` can set the layout in the custom middleware.
+ *
+ * @see {@link https://hono.dev/api/context#render-setrenderer}
+ *
* @example
* ```tsx
* app.use('*', async (c, next) => {
@@ -251,7 +260,6 @@ export class Context<
* await next()
* })
* ```
- * @see https://hono.dev/api/context#render-setrenderer
*/
setRenderer = (renderer: Renderer) => {
this.renderer = renderer
@@ -259,6 +267,9 @@ export class Context<
/**
* `.header()` can set headers.
+ *
+ * @see {@link https://hono.dev/api/context#body}
+ *
* @example
* ```ts
* app.get('/welcome', (c) => {
@@ -269,7 +280,6 @@ export class Context<
* return c.body('Thank you for coming')
* })
* ```
- * @see https://hono.dev/api/context#body
*/
header = (name: string, value: string | undefined, options?: { append?: boolean }): void => {
// Clear the header
@@ -317,6 +327,9 @@ export class Context<
/**
* `.set()` can set the value specified by the key.
+ *
+ * @see {@link https://hono.dev/api/context#set-get}
+ *
* @example
* ```ts
* app.use('*', async (c, next) => {
@@ -324,7 +337,6 @@ export class Context<
* await next()
* })
* ```
- * @see https://hono.dev/api/context#set-get
```
*/
set: Set