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

aiohttp-cors accesses the aiohttp protected self._routes #483

Open
bdraco opened this issue Nov 26, 2024 · 2 comments
Open

aiohttp-cors accesses the aiohttp protected self._routes #483

bdraco opened this issue Nov 26, 2024 · 2 comments

Comments

@bdraco
Copy link
Member

bdraco commented Nov 26, 2024

preflight_route = resource._routes[hdrs.METH_OPTIONS]

          > `aiohttp-cors` accesses the protected `self._routes` here and relies on being able to add new methods

We could just update that library?

Originally posted by @Dreamsorcerer in aio-libs/aiohttp#9972 (comment)

@bdraco bdraco transferred this issue from aio-libs/aiohttp Nov 26, 2024
@bdraco bdraco changed the title > aiohttp-cors accesses the protected self._routes here and relies on being able to add new methods aiohttp-cors accesses the aiohttp protected self._routes Nov 26, 2024
@bdraco
Copy link
Member Author

bdraco commented Nov 26, 2024

We may need to expose a public method in aiohttp for this so this library doesn't need to access the protected one

@asvetlov
Copy link
Member

Good finding!
IIRC a resource can iterate over routes; it works but could be inefficient for the library.
Adding resource.routes property that returns a read-only mapping looks like a reasonable addition to me.

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

2 participants