forked from gookit/rux
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathissues_test.go
More file actions
35 lines (27 loc) · 723 Bytes
/
issues_test.go
File metadata and controls
35 lines (27 loc) · 723 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package rux_test
import (
"testing"
"github.com/gookit/goutil/dump"
"github.com/gookit/goutil/testutil/assert"
"github.com/gookit/rux"
)
func TestIssue_60(t *testing.T) {
r := rux.New()
is := assert.New(t)
r.GET(`/blog/{id:\d+}`, func(c *rux.Context) {
c.Text(200, "view detail, id: "+c.Param("id"))
})
route, _, _ := r.Match("GET", "/blog/100")
is.NotEmpty(route)
// dump.P(route.Info())
route, _, _ = r.Match("GET", "/blog/100/")
is.NotEmpty(route)
dump.P(route.Info())
r1 := rux.New(rux.StrictLastSlash)
r1.GET(`/blog/{id:\d+}`, func(c *rux.Context) {
c.Text(200, "view detail, id: "+c.Param("id"))
})
route, _, _ = r1.Match("GET", "/blog/100/")
is.Empty(route)
// dump.P(route.Info())
}