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

Accessing CallContext from handlers #38

Open
SegaraRai opened this issue May 13, 2022 · 1 comment
Open

Accessing CallContext from handlers #38

SegaraRai opened this issue May 13, 2022 · 1 comment

Comments

@SegaraRai
Copy link

SegaraRai commented May 13, 2022

CallContext, which is the argument of the handler created by createCall, can have additional properties, but those properties are not passed to the actual handler (such as h3 app) and are not accessible.

Cloudflare Workers, for example, may need access to event and I want a way to access this.
https://github.com/unjs/nitro/blob/v0.4.4/src/runtime/entries/cloudflare.ts#L26

One suggested solution is to add context prop to req.
(req as any)._callContext = context, or (req as any)[symCallContext] = context (using symbol)

@SegaraRai
Copy link
Author

May not needed when unjs/h3#73 is done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant