diff --git a/packages/adapter-h3/src/common.ts b/packages/adapter-h3/src/common.ts index beb818d..fab7cbc 100644 --- a/packages/adapter-h3/src/common.ts +++ b/packages/adapter-h3/src/common.ts @@ -65,6 +65,7 @@ export function createHandler(event); return this[universalSymbol](toWebRequest(event), ctx, getRuntime(event)); }), + eventHandler, ); }; } @@ -144,6 +145,7 @@ export function createMiddleware< event.context[contextSymbol] = response; } }), + eventHandler, ); }; } diff --git a/packages/core/src/utils.ts b/packages/core/src/utils.ts index 474161f..8dbc8d9 100644 --- a/packages/core/src/utils.ts +++ b/packages/core/src/utils.ts @@ -56,12 +56,12 @@ export function bindUniversal< // biome-ignore lint/suspicious/noExplicitAny: U extends UniversalHandler | UniversalMiddleware, F extends UniversalFn, ->(universal: U, fn: SetThis): F { +>(universal: U, fn: SetThis, wrapper?: AnyFn): F { const unboundFn = unboundSymbol in fn ? (fn[unboundSymbol] as F) : fn; const self = { [universalSymbol]: universal, [unboundSymbol]: unboundFn }; const boundFn = unboundFn.bind(self) as F; Object.assign(boundFn, self); - return boundFn; + return wrapper ? (wrapper(boundFn) as F) : boundFn; } /**