You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes it's very useful to have a custom router instead of built-in one. For instance, as it was mentioned in #1373, in order to implement API versioning we may want to check that API version is passed by client. If not, we need to reject the request with some error response (e.g. 412 Precondition Failed).
Unfortunately, since 1.1 it's no longer possible as any attempt to do so fails with 500 Internal Server Error on this line (match_info is None in this case):
Since aiohttp 1.1 some backward incompatible changes have been
implemented. Despite each of them has its own issue on GitHub:
- aio-libs/aiohttp#1373
- aio-libs/aiohttp#1416
it's not clear when they become resolved. In order to be able to
fly on latest aiohttp version, this commit resolves those issues
by implementing workarounds on our side.
Long story short
Sometimes it's very useful to have a custom router instead of built-in one. For instance, as it was mentioned in #1373, in order to implement API versioning we may want to check that API version is passed by client. If not, we need to reject the request with some error response (e.g.
412 Precondition Failed
).Unfortunately, since 1.1 it's no longer possible as any attempt to do so fails with
500 Internal Server Error
on this line (match_info
isNone
in this case):https://github.com/KeepSafe/aiohttp/blob/v1.1.5/aiohttp/web_reqrep.py#L736
Expected behaviour
web_exceptions.*
can be thrown from router'sresolve()
method and are transformed to appropriate HTTP response code.Actual behaviour
Any attempt to throw
web_exceptions.*
lead to the500 Internal Server Error
.Steps to reproduce
Here's an exploit (run with
pytest
):Your environment
The text was updated successfully, but these errors were encountered: