Check if param names differ.
This commit is contained in:
parent
653bae85f5
commit
257bd7ea76
8
httpr.go
8
httpr.go
@ -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
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user