-
Notifications
You must be signed in to change notification settings - Fork 339
feat: enhance validation capabilities for routes and handlers #1237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 4 commits
ecbb966
c750ce8
a67bb00
db67cf7
01c9843
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -161,7 +161,7 @@ export function validatedURL( | |||||||||||||||||||||||||
| return url; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| function syncValidate<Source extends "headers" | "query", T = unknown>( | ||||||||||||||||||||||||||
| export function syncValidate<Source extends string, T = unknown>( | ||||||||||||||||||||||||||
| source: Source, | ||||||||||||||||||||||||||
| data: unknown, | ||||||||||||||||||||||||||
| fn: StandardSchemaV1<T>, | ||||||||||||||||||||||||||
|
|
@@ -199,3 +199,24 @@ function createValidationError(cause: Error | HTTPError | ErrorDetails | Failure | |||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||
| * Validates a response value against a schema. | ||||||||||||||||||||||||||
| * Response validation errors use 500 status (server error) instead of 400. | ||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||
| export async function validateResponse<Schema extends StandardSchemaV1>( | ||||||||||||||||||||||||||
| value: unknown, | ||||||||||||||||||||||||||
| schema: Schema, | ||||||||||||||||||||||||||
| ): Promise<InferOutput<Schema>> { | ||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||
| return await validateData(value, schema); | ||||||||||||||||||||||||||
| } catch (error: any) { | ||||||||||||||||||||||||||
| throw new HTTPError({ | ||||||||||||||||||||||||||
| cause: error, | ||||||||||||||||||||||||||
| status: 500, | ||||||||||||||||||||||||||
| statusText: "Response validation failed", | ||||||||||||||||||||||||||
| message: error?.message || "Response validation failed", | ||||||||||||||||||||||||||
| data: error?.data, | ||||||||||||||||||||||||||
|
Comment on lines
+217
to
+228
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't return validator internals from 500 responses. Response-schema mismatches are server bugs, not client input errors. Forwarding Suggested fix } catch (error: any) {
throw new HTTPError({
cause: error,
status: 500,
statusText: "Response validation failed",
- message: error?.message || "Response validation failed",
- data: error?.data,
+ message: "Response validation failed",
});
}
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,13 +1,29 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import type { H3RouteMeta, HTTPMethod } from "../types/h3.ts"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import type { EventHandler, Middleware } from "../types/handler.ts"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import type { EventHandlerRequest, Middleware } from "../types/handler.ts"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import type { H3Plugin, H3 } from "../types/h3.ts"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import type { StandardSchemaV1 } from "./internal/standard-schema.ts"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import type { H3Event } from "../event.ts"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import type { StandardSchemaV1, InferOutput } from "./internal/standard-schema.ts"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { defineValidatedHandler } from "../handler.ts"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type StringHeaders<T> = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [K in keyof T]: Extract<T[K], string>; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Route validation schemas | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export interface RouteValidation { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| body?: StandardSchemaV1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| headers?: StandardSchemaV1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| query?: StandardSchemaV1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| params?: StandardSchemaV1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| response?: StandardSchemaV1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Route definition options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Route definition options with type-safe validation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export interface RouteDefinition { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export interface RouteDefinition<V extends RouteValidation = RouteValidation> { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * HTTP method for the route, e.g. 'GET', 'POST', etc. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -21,7 +37,21 @@ export interface RouteDefinition { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Handler function for the route. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| handler: EventHandler; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| handler: ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| event: H3Event< | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| EventHandlerRequest & { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| body: V["body"] extends StandardSchemaV1 ? InferOutput<V["body"]> : unknown; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| query: V["query"] extends StandardSchemaV1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? StringHeaders<InferOutput<V["query"]>> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : Partial<Record<string, string>>; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| routerParams: V["params"] extends StandardSchemaV1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? InferOutput<V["params"]> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : Record<string, string>; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| >, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | (V["response"] extends StandardSchemaV1 ? InferOutput<V["response"]> : unknown) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | Promise<V["response"] extends StandardSchemaV1 ? InferOutput<V["response"]> : unknown>; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: cd /repo && find . -type f -name "route.ts" -o -name "index.ts" | head -20Repository: h3js/h3 Length of output: 106 🏁 Script executed: cd /repo && wc -l src/utils/route.ts src/index.tsRepository: h3js/h3 Length of output: 106 🏁 Script executed: cd /repo && cat -n src/utils/route.ts | head -160Repository: h3js/h3 Length of output: 106 🏁 Script executed: cd /repo && cat -n src/index.tsRepository: h3js/h3 Length of output: 106 🏁 Script executed: find . -type f -name "route.ts" -o -name "index.ts" 2>/dev/null | grep -E "(route\.ts|index\.ts)$"Repository: h3js/h3 Length of output: 86 🏁 Script executed: wc -l src/utils/route.ts src/index.ts 2>/dev/null || echo "Files not found, listing directory structure..."Repository: h3js/h3 Length of output: 103 🏁 Script executed: ls -la src/utils/ && ls -la src/ 2>/dev/null || find . -name "route.ts" -type fRepository: h3js/h3 Length of output: 2279 🏁 Script executed: cat -n src/utils/route.tsRepository: h3js/h3 Length of output: 6883 🏁 Script executed: cat -n src/index.tsRepository: h3js/h3 Length of output: 5568 Documentation example handler must be declared The example at lines 163-168 uses 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Optional middleware to run before the handler. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -33,38 +63,104 @@ export interface RouteDefinition { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| meta?: H3RouteMeta; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Validation schemas | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // TODO: Support generics for better typing `handler` input | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| validate?: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| body?: StandardSchemaV1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| headers?: StandardSchemaV1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| query?: StandardSchemaV1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Validation schemas for request and response | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| validate?: V; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Helper type for validated H3Event with typed context.params | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type ValidatedRouteEvent<RequestT extends EventHandlerRequest, ParamsT> = Omit< | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| H3Event<RequestT>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "context" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > & { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| context: Omit<H3Event["context"], "params"> & { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| params?: ParamsT; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Overload: With validation (any combination of validation schemas) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export function defineRoute< | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Body extends StandardSchemaV1 = never, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Headers extends StandardSchemaV1 = never, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Query extends StandardSchemaV1 = never, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Params extends StandardSchemaV1 = never, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Response extends StandardSchemaV1 = never, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| >(def: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| method: HTTPMethod; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| route: string; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| validate: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| body?: Body; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| headers?: Headers; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| query?: Query; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| params?: Params; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| response?: Response; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| handler: ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| event: ValidatedRouteEvent< | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| EventHandlerRequest & { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| body: [Body] extends [never] ? unknown : InferOutput<Body>; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| query: [Query] extends [never] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? Partial<Record<string, string>> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : StringHeaders<InferOutput<Query>>; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| routerParams: [Params] extends [never] ? Record<string, string> : InferOutput<Params>; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [Params] extends [never] ? Record<string, string> : InferOutput<Params> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| >, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | ([Response] extends [never] ? unknown : InferOutput<Response>) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | Promise<[Response] extends [never] ? unknown : InferOutput<Response>>; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| middleware?: Middleware[]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| meta?: H3RouteMeta; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }): H3Plugin; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Overload: Without validation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export function defineRoute(def: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| method: HTTPMethod; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| route: string; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| handler: (event: H3Event) => unknown | Promise<unknown>; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| middleware?: Middleware[]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| meta?: H3RouteMeta; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| validate?: never; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }): H3Plugin; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Define a route as a plugin that can be registered with app.register() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Routes defined with this function automatically get type-safe validation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * for params, query, body, and response based on the provided schemas. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @example | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * ```js | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * import { z } from "zod"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * const userRoute = defineRoute({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * method: 'POST', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * route: '/api/users/:id', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * validate: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * query: z.object({ id: z.string().uuid() }), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * params: z.object({ id: z.string().uuid() }), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * query: z.object({ include: z.string().optional() }), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * body: z.object({ name: z.string() }), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * response: z.object({ id: z.string(), name: z.string() }), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * handler: (event) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * return { success: true }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * // event.context.params, await event.req.json(), and return value are all typed! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * const { id } = event.context.params; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * const body = await event.req.json(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * return { id, name: body.name }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * app.register(userRoute); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * app.use(userRoute); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * ``` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
150
to
172
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: find . -name "route.ts" -type f | head -20Repository: h3js/h3 Length of output: 71 🏁 Script executed: cat -n src/utils/route.ts | head -200Repository: h3js/h3 Length of output: 6883 Fix the example code before publishing it. The example has two issues:
Suggested fix- * handler: (event) => {
+ * handler: async (event) => {
* // event.context.params, await event.req.json(), and return value are all typed!
* const { id } = event.context.params;
* const body = await event.req.json();
* return { id, name: body.name };
* }
* });
*
- * app.use(userRoute);
+ * app.register(userRoute);
* ```📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export function defineRoute(def: RouteDefinition): H3Plugin { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const handler = defineValidatedHandler(def) as any; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export function defineRoute<V extends RouteValidation>(def: RouteDefinition<V>): H3Plugin { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // TypeScript cannot infer complex conditional types between RouteDefinition and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // defineValidatedHandler parameters. Runtime types are identical and safe. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type ValidatedHandlerParam = Parameters<typeof defineValidatedHandler>[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const handler = defineValidatedHandler(def as unknown as ValidatedHandlerParam); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return (h3: H3) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| h3.on(def.method, def.route, handler); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.