Check if param names differ.

This commit is contained in:
Alexander Andreev 2023-05-28 03:17:53 +04:00
parent 653bae85f5
commit 257bd7ea76
Signed by: Arav
GPG Key ID: D22A817D95815393

View File

@ -114,6 +114,14 @@ outer:
for _, child := range curNode.children { for _, child := range curNode.children {
firstChar := path[i+1][0] firstChar := path[i+1][0]
if (firstChar == ':' || firstChar == '*') && firstChar == child.endpoint[0] { if (firstChar == ':' || firstChar == '*') && firstChar == child.endpoint[0] {
// Do not allow different param names, because only the first one
// is saved, so a param won't be available by a new name.
//
// I am not the one to judge, but it is a little strange to
// expect different types of param in one place.
if path[i+1] != child.endpoint {
return errors.New("param names " + path[i+1] + " and " + child.endpoint + " are differ")
}
curNode = child curNode = child
continue outer continue outer
} }