1
0
Fork 0

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
1 changed files with 8 additions and 0 deletions

View File

@ -114,6 +114,14 @@ outer:
for _, child := range curNode.children {
firstChar := path[i+1][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
continue outer
}