Skip to content
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

fix: ensure h3 eventHandler is called #82

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/adapter-h3/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export function createHandler<T extends unknown[], InContext extends Universal.C
const ctx = initContext<InContext>(event);
return this[universalSymbol](toWebRequest(event), ctx, getRuntime(event));
}),
eventHandler,
);
};
}
Expand Down Expand Up @@ -144,6 +145,7 @@ export function createMiddleware<
event.context[contextSymbol] = response;
}
}),
eventHandler,
);
};
}
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ export function bindUniversal<
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
U extends UniversalHandler<any> | UniversalMiddleware<any, any>,
F extends UniversalFn<U, AnyFn>,
>(universal: U, fn: SetThis<F, { [universalSymbol]: U }>): F {
>(universal: U, fn: SetThis<F, { [universalSymbol]: U }>, 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;
}

/**
Expand Down
Loading