summaryrefslogtreecommitdiff
path: root/cli/bench/testdata/npm/hono/dist/context.d.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cli/bench/testdata/npm/hono/dist/context.d.ts')
-rw-r--r--cli/bench/testdata/npm/hono/dist/context.d.ts69
1 files changed, 69 insertions, 0 deletions
diff --git a/cli/bench/testdata/npm/hono/dist/context.d.ts b/cli/bench/testdata/npm/hono/dist/context.d.ts
new file mode 100644
index 000000000..1f67f6206
--- /dev/null
+++ b/cli/bench/testdata/npm/hono/dist/context.d.ts
@@ -0,0 +1,69 @@
+/// <reference types="@cloudflare/workers-types" />
+import type { ContextVariableMap, NotFoundHandler } from './hono';
+import type { CookieOptions } from './utils/cookie';
+import type { StatusCode } from './utils/http-status';
+declare type Headers = Record<string, string>;
+export declare type Data = string | ArrayBuffer | ReadableStream;
+declare type Env = Record<string, any>;
+export interface Context<RequestParamKeyType extends string = string, E = Env> {
+ req: Request<RequestParamKeyType>;
+ 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 extends keyof ContextVariableMap>(key: Key, value: ContextVariableMap[Key]): void;
+ (key: string, value: any): void;
+ };
+ get: {
+ <Key extends keyof ContextVariableMap>(key: Key): ContextVariableMap[Key];
+ <T = any>(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: <T>(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<Response>;
+}
+export declare class HonoContext<RequestParamKeyType extends string = string, E = Env> implements Context<RequestParamKeyType, E> {
+ req: Request<RequestParamKeyType>;
+ 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 extends keyof ContextVariableMap>(key: Key, value: ContextVariableMap[Key]): void;
+ set(key: string, value: any): void;
+ get<Key extends keyof ContextVariableMap>(key: Key): ContextVariableMap[Key];
+ get<T = any>(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<T>(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<Response>;
+}
+export {};