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.
This PR should fix #355 can be resumed in the following steps:
isEndOfRoute
to theNode
class to know when a node is the end of the route or not.UnsafePointer
as thesterror
returns aUnsafeMutablePointer<Int8>!
causing the build fails in CircleCI with Xcode 10.2. (Disambiguate swift method call #367)The Trie formed during the registration of the routes was not handling when a node was the end of a route or not causing it was impossible to detect or match routes ending in this node correctly.
The good examples provided in #355 summarize the unit test added:
a/:id
a/:id/c
The first case should be recognized as a final of a router when it's added to Trie to be able to match possible prefix or routes in the tree.
The function
inflate(_ node: inout Node, generator: inout IndexingIterator<[String]>) -> Node
in theHttpRouter
was refactored to set when a node is the end of the route or not during the insertion of a new route and to remove the recursion.