Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions trie.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,11 @@ func (s *intMatcher) match(iter *charIter) bool {
c, sep, ok := iter.next()
count++

// if it's the end of the string, it's a match
if !ok {
return true
}

// if the current character is not a number:
// - it's either a separator that means it's a match
// - it's some other character that means it's not a match
Expand All @@ -391,11 +396,6 @@ func (s *intMatcher) match(iter *charIter) bool {
return false
}
}

// if it's the end of the string, it's a match
if !ok {
return true
}
}
}

Expand Down
6 changes: 6 additions & 0 deletions trie_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,12 @@ func (s *TrieSuite) TestMergeAndMatchCases(c *C) {
"http://google.com/v42/domains/domain1",
"/v<int:version>/domains/<string:name>",
},
// Int matcher at the end of the Trie
{
[]string{"/v<int:version>/domains/<int:name>"},
"http://google.com/v42/domains/1",
"/v<int:version>/domains/<int:name>",
},
// Int matcher, no match
{
[]string{"/v<int:version>/domains/<string:name>", "/<string:version>/domains/<string:name>"},
Expand Down