mirror of
https://github.com/labstack/echo.git
synced 2024-12-24 20:14:31 +02:00
tests and fix for findChildByKind executed on nil node
This commit is contained in:
parent
802fb5bba6
commit
e1d21a73cf
@ -218,6 +218,9 @@ func (n *node) findChildWithLabel(l byte) *node {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (n *node) findChildByKind(t kind) *node {
|
func (n *node) findChildByKind(t kind) *node {
|
||||||
|
if n == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
for _, c := range n.children {
|
for _, c := range n.children {
|
||||||
if c.kind == t {
|
if c.kind == t {
|
||||||
return c
|
return c
|
||||||
|
@ -756,6 +756,12 @@ func TestRouterPriorityNotFound(t *testing.T) {
|
|||||||
c.Set("b", 2)
|
c.Set("b", 2)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
r.Add(http.MethodGet, "/:lang/", func(c Context) error {
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
r.Add(http.MethodGet, "/:lang/dupa", func(c Context) error {
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
// Find
|
// Find
|
||||||
r.Find(http.MethodGet, "/a/foo", c)
|
r.Find(http.MethodGet, "/a/foo", c)
|
||||||
|
Loading…
Reference in New Issue
Block a user