Fix special case where "/" would match with all paths - #3
Open
rgigger wants to merge 1 commit into
Open
Conversation
Member
|
I think Macro currently does a prefix match on all calls. So I think we would rather want to change that if Express.js does exact matches? |
Author
|
Yes, I think that's right. Currently Macro does a prefix match in the sense that a route using the pattern '/cows' will match with a path of '/cows/list' but it won't match with say '/cowss'. But yeah the express behavior is to not match either of those. I will generalize it do exact matches everywhere and update the PR. |
Member
|
I recently added some "route" tests, would be cool to have those in sync as well and test the desired behavior. I wonder whether prefix matching '/cows' is currently required for mounting, or whether that needs special behavior then. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I noticed that if I put my "/" route first that it would match with all paths, so I had to list it as the last path in order for anything to work. I am not sure if adding another special case rule is the best way to fix but it does seem to do the job. This causes MacroExpress to now match the behavior of exress.js in the same situation.