diff --git a/README.md b/README.md index 20486920..784f23d8 100644 --- a/README.md +++ b/README.md @@ -214,9 +214,9 @@ H3 has a concept of composable utilities that accept `event` (from `eventHandler - `getQuery(event)` - `getValidatedQuery(event, validate)` -- `getRouterParams(event, opts)` -- `getRouterParam(event, name, opts)` -- `getValidatedRouterParams(event, validate)` +- `getRouterParams(event, { decode? })` +- `getRouterParam(event, name, { decode? })` +- `getValidatedRouterParams(event, validate, { decode? })` - `getMethod(event, default?)` - `isMethod(event, expected, allowHead?)` - `assertMethod(event, expected, allowHead?)` diff --git a/src/utils/request.ts b/src/utils/request.ts index 9649bd7d..359826df 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -46,8 +46,12 @@ export function getValidatedRouterParams< T, Event extends H3Event = H3Event, _T = InferEventInput<"routerParams", Event, T>, ->(event: Event, validate: ValidateFunction<_T>): Promise<_T> { - const routerParams = getRouterParams(event); +>( + event: Event, + validate: ValidateFunction<_T>, + opts: { decode?: boolean } = {}, +): Promise<_T> { + const routerParams = getRouterParams(event, opts); return validateData(routerParams, validate); }