///
import type { ContextVariableMap, NotFoundHandler } from './hono';
import type { CookieOptions } from './utils/cookie';
import type { StatusCode } from './utils/http-status';
declare type Headers = Record;
export declare type Data = string | ArrayBuffer | ReadableStream;
declare type Env = Record;
export interface Context {
req: Request;
env: E;
event: FetchEvent;
executionCtx: ExecutionContext;
finalized: boolean;
get res(): Response;
set res(_res: Response);
header: (name: string, value: string) => void;
status: (status: StatusCode) => void;
set: {
(key: Key, value: ContextVariableMap[Key]): void;
(key: string, value: any): void;
};
get: {
(key: Key): ContextVariableMap[Key];
(key: string): T;
};
pretty: (prettyJSON: boolean, space?: number) => void;
newResponse: (data: Data | null, status: StatusCode, headers: Headers) => Response;
body: (data: Data | null, status?: StatusCode, headers?: Headers) => Response;
text: (text: string, status?: StatusCode, headers?: Headers) => Response;
json: (object: T, status?: StatusCode, headers?: Headers) => Response;
html: (html: string, status?: StatusCode, headers?: Headers) => Response;
redirect: (location: string, status?: StatusCode) => Response;
cookie: (name: string, value: string, options?: CookieOptions) => void;
notFound: () => Response | Promise;
}
export declare class HonoContext implements Context {
req: Request;
env: E;
finalized: boolean;
_status: StatusCode;
private _executionCtx;
private _pretty;
private _prettySpace;
private _map;
private _headers;
private _res;
private notFoundHandler;
constructor(req: Request, env?: E | undefined, executionCtx?: FetchEvent | ExecutionContext | undefined, notFoundHandler?: NotFoundHandler);
get event(): FetchEvent;
get executionCtx(): ExecutionContext;
get res(): Response;
set res(_res: Response);
header(name: string, value: string): void;
status(status: StatusCode): void;
set(key: Key, value: ContextVariableMap[Key]): void;
set(key: string, value: any): void;
get(key: Key): ContextVariableMap[Key];
get(key: string): T;
pretty(prettyJSON: boolean, space?: number): void;
newResponse(data: Data | null, status: StatusCode, headers?: Headers): Response;
body(data: Data | null, status?: StatusCode, headers?: Headers): Response;
text(text: string, status?: StatusCode, headers?: Headers): Response;
json(object: T, status?: StatusCode, headers?: Headers): Response;
html(html: string, status?: StatusCode, headers?: Headers): Response;
redirect(location: string, status?: StatusCode): Response;
cookie(name: string, value: string, opt?: CookieOptions): void;
notFound(): Response | Promise;
}
export {};