Skip to content

Add ValidURLRouter to handle unmatched routes (#2147) #2162

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sprezz-arthur
Copy link

Follow-up from #2147.

My attempt to solve the status code 500 on unmatched routes.
Solving it for http requests was quite straight-forward, as I could return 404 directly, but for websocket requests I could only manage to get a 403 by prematurely closing the connection before the handshake.

To make it non-breaking, I opted for extending URLRouter into ValidURLRouter, as some of the tests in tests/test_routing.py rely on having Exceptions raised.

@sprezz-arthur sprezz-arthur force-pushed the 1-return-4xx-on-unmatched-routes branch from 0ccf947 to de08c46 Compare June 8, 2025 22:38
@carltongibson
Copy link
Member

To make it non-breaking, I opted for extending URLRouter into ValidURLRouter, as some of the tests in tests/test_routing.py rely on having Exceptions raised.

You don't seem to have pushed that version 🤔

@sprezz-arthur sprezz-arthur force-pushed the 1-return-4xx-on-unmatched-routes branch from de08c46 to ea7535e Compare June 9, 2025 12:01
@sprezz-arthur
Copy link
Author

To make it non-breaking, I opted for extending URLRouter into ValidURLRouter, as some of the tests in tests/test_routing.py rely on having Exceptions raised.

You don't seem to have pushed that version 🤔

My bad, bad rebase, should be fine now.

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

Successfully merging this pull request may close these issues.

2 participants