Check the parameter names to ensure there are no duplicates after parsing a route#39
Check the parameter names to ensure there are no duplicates after parsing a route#39gameldar wants to merge 3 commits intohttp-rs:mainfrom
Conversation
|
Not sure if we want to do this as is (original commit enforced a panic instead... which again is undesirable for a library crate) - it does introduce a return value for the add method. Alternatively we could introduce a add_and_validate (or something like that) that allow you to choose to validate the names and potentially deprecate the old implementation? |
|
One idea would be to add a builder, so you would add routes to the builder then get the Alternatively, there could be two add methods, maybe an |
…te parameter names
add calls add_check and unwraps it Also added a bit of documentation around the router and the add methods
11a9b0b to
fa0f7d6
Compare
Description
After parsing a route go through the parameter names to ensure there aren't duplicates. If there are panic so we abort at initial creation.
Note this changes the add method to now return a Result (so warning will be produced with existing usage about an unused return value).
Motivation and Context
Closes #34
How Has This Been Tested?
Unit tests exist for the new conditions
Types of changes
Checklist: