Fix the documentation for wildcards for path definitions to match implementation #254
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.
Fixed the documentation for wildcards for path definitions for routing and added a bunch of tests that demonstrate the implemented behavior.
Description
The documentation referred to syntax like :name* but this isn't actually supported by the route recognizer, instead it is looking for *name for named path matches. So I've fixed the explanation and given more examples.
Additionally I added a number of tests for these different path options.
Motivation and Context
I was starting out with Tide and was trying to get some routes working - in particular capturing the rest of the path and so headed to the documentation to find the suggested wildcard of :path* which should match. Trying to use this caused issues with not being able to find the parameter back (as it turns out it is because the * gets added to the name so you can use context.param("path*") to get the value back - but it only matches the next segment).
Looking through blame I tracked it back to the underlying issue - #12 and I can see that isn't resolved/finalized yet. Looking at some of the behaviour that is possible (partly why the tests are there) - I can see that there might be some undesirable routing behaviour (e.g. just using
:
to namelessly match) might be an issue.How Has This Been Tested?
I've run the tests after these changes and the extra tests I'ved added. I'm testing on Debian Testing using the nightly version of Rust from 2019-05-21.
Types of changes
Checklist: