-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
With or without trailing slash will be matched to different endpoints #2411
Comments
This will be mostly fixed in the next release, with the parameters no longer matching empty strings by default. I recommend always setting |
Thank you for the reply! Since in pre-21.3 version, both |
Yeah, this was a regression (or unintended change in behavior) in v21.3, caused by the introduction of the new Router, it was not corrected until recently. As @Tronic said, this will revert to the pre-21.3 behavior in the next release (v22.3), and you will not need to add |
Closing as duplicate of #2391 #2384 #2239 PR fixing the regression: sanic-org/sanic-routing#58 |
Describe the bug
Hi, during our upgrade of Sanic from 19.9.0 to a higher one at 21.9.3, we ran into a seemly behavior change for path routing.
A clear and concise description of what the bug is, make sure to paste any exceptions and tracebacks.
With two GET endpoints
In Sanic 19.9.0,
curl 'http://127.0.0.1:8000/test/'
will be routed to endpoint 1In Sanic 21.9.3,
curl 'http://127.0.0.1:8000/test/'
will be routed to endpoint 2 with empty string as parameterIn both Sanic 19.9.0 and 21.9.3,
curl 'http://127.0.0.1:8000/test'
resolves to endpoint 1, expectedly.Code snippet
Relevant source code, make sure to remove what is not necessary.
Expected behavior
A clear and concise description of what you expected to happen.
This backward incompatibility does not seem to be documented.
Environment (please complete the following information):
Additional context
Add any other context about the problem here.
We'll appreciate helps on a way to keep the old behavior for a smooth transition.
The text was updated successfully, but these errors were encountered: