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

Allow Handlers to have an instance #21

Open
msrd0 opened this issue Mar 10, 2021 · 0 comments
Open

Allow Handlers to have an instance #21

msrd0 opened this issue Mar 10, 2021 · 0 comments

Comments

@msrd0
Copy link
Owner

msrd0 commented Mar 10, 2021

As of right now, we do not allow Handlers to have an instance, that is, their respective handle method must not use the self parameter. This might be inconvenient in some cases, where the handler depends on runtime-data that shouldn't be stored in static variables. A good example for this would be the OpenAPI handler that is currently implemented as a raw gotham handler rather than as a resource read-all handler since it needs the specification, and there is currently no good way to infer it without using a middleware.

We should allow handlers to take self or &self parameters so they can refer to runtime data.

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