-
-
Notifications
You must be signed in to change notification settings - Fork 59
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
[request] Some mechanism to add CORS-rules to an endpoint/a router/everything. #31
Comments
Would it be possible to put into a trait? I could imagin that a user who needs cors could just mix in the trait to their routes. |
I think it's a bit trickier—but I may be wrong. To add CORS in a somewhat convenient manner we'd need to:
Preferably it should be possible to configure at least some of these aspects. To get access to an endpoint's allowed methods the only way I found was to apply the CORS-rules to Perhaps it is possible to wrap an endpoint decorator with a cors-decorator? That would make things slightly simpler—provided the cors-decorator can access the endpoint-decorator—but would still have to be repeated for all endpoints of a route, as I see no way to automatically attach one. |
FYI, I've built a CorsHandler that works in initial tests. See:
Naturally, this can be built multiple ways. Note how a CorsHandler is initialized in Server, which extends cask.Main. |
Here's what I've found so far:
Main#defaultHandler
seems to be the way forward but this feels very "low-level" and introduces some concern-splittingI'm willing to do some legwork here but I'd like to know if you have any ideas on how this can best be solved.
The text was updated successfully, but these errors were encountered: