Skip to content
This repository was archived by the owner on Dec 9, 2024. It is now read-only.

Commit a0794b2

Browse files
authored
Fix defining multiple subscriptions on root path (#472)
1 parent 5e02910 commit a0794b2

File tree

3 files changed

+191
-183
lines changed

3 files changed

+191
-183
lines changed

internal/pathtree/tree.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@ type Params map[string]string
3333
// nolint: gocyclo
3434
func (n *Node) AddRoute(route string, value interface{}) error {
3535
if route == "/" {
36-
n.value = value
37-
return nil
36+
if n.value == nil {
37+
n.value = value
38+
return nil
39+
}
40+
return fmt.Errorf("route / conflicts with existing route")
3841
}
3942

4043
segments := toSegments(route)

0 commit comments

Comments
 (0)