-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Don't redirect to slash route when method does not match #907
Conversation
Hmm, I see it's failing some tests. I'll look into those. |
I think you're on the right track here. Thanks for working on this. |
69f0afa
to
596bd0e
Compare
596bd0e
to
33258e1
Compare
I think they should be fixed now. I didn't check if self.methods was defined. |
BTW, I also changed the documentation of the method as it mentioned that the method could be supplied in the |
@@ -765,7 +765,9 @@ def match(self, path): | |||
# tells the map to redirect to the same url but with a | |||
# trailing slash | |||
if self.strict_slashes and not self.is_leaf and \ | |||
not groups.pop('__suffix__'): | |||
not groups.pop('__suffix__') and \ | |||
(method is None or self.methods is None or |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
LGTM, but I'm unsure if I might be missing something. @mitsuhiko should look at this since I'm not very familiar with routing. |
Needs a test. |
I just added tests, that I think cover all scenarios. I think the raised exceptions make sense as well. |
Should I squash the commits together afterwards or should I leave them like this? |
Any updates on merging this? |
I've just pinged @mitsuhiko in IRC. |
Sorry for the long wait. I've just merged this and it will land in 0.12. Thanks! |
This is a very simple fix for pallets/flask#1783, it simply only redirects to slash when the method matches as well. I think this would qualify as backwards compatible as it only changes behaviour for routes that previously returned a 405 where there were actual routes matching the route exactly.