Skip to content

Commit b291800

Browse files
committed
fixed bugs in prefix routes
1 parent e262d48 commit b291800

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
GRRT (Go Request RouTer) is a direct replacement for the archived gorilla/mux.
44
It has built-in CORS and Method based routing.
55

6+
67
## Replaces gorilla/mux with one line of code
78

89
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=GolangToolKits_grrt&metric=alert_status)](https://sonarcloud.io/dashboard?id=GolangToolKits_grrt)

coverage.out

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ github.com/GolangToolKits/grrt/reqRouter.go:214.96,216.36 2 1
5959
github.com/GolangToolKits/grrt/reqRouter.go:221.2,222.27 2 1
6060
github.com/GolangToolKits/grrt/reqRouter.go:216.36,217.32 1 1
6161
github.com/GolangToolKits/grrt/reqRouter.go:217.32,219.4 1 1
62-
github.com/GolangToolKits/grrt/router.go:29.25,32.2 2 1
63-
github.com/GolangToolKits/grrt/router.go:35.46,37.49 2 1
64-
github.com/GolangToolKits/grrt/router.go:40.2,40.12 1 1
65-
github.com/GolangToolKits/grrt/router.go:37.49,39.3 1 1
66-
github.com/GolangToolKits/grrt/router.go:44.72,47.2 2 1
62+
github.com/GolangToolKits/grrt/router.go:29.25,34.2 4 1
63+
github.com/GolangToolKits/grrt/router.go:37.46,39.49 2 1
64+
github.com/GolangToolKits/grrt/router.go:42.2,42.12 1 1
65+
github.com/GolangToolKits/grrt/router.go:39.49,41.3 1 1
66+
github.com/GolangToolKits/grrt/router.go:46.72,49.2 2 1
6767
github.com/GolangToolKits/grrt/reqRoute.go:28.32,32.2 3 1
6868
github.com/GolangToolKits/grrt/reqRoute.go:35.56,36.14 1 1
6969
github.com/GolangToolKits/grrt/reqRoute.go:39.2,39.10 1 1

router.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ type Router interface {
2727

2828
// NewRouter NewRouter creates new Router
2929
func NewRouter() Router {
30-
var rtn = ReqRouter{namedRoutes: make(map[string]*[]Route)}
30+
var rtn ReqRouter
31+
rtn.namedRoutes = make(map[string]*[]Route)
32+
rtn.prefixRoutes = make(map[string]Route)
3133
return &rtn
3234
}
3335

router_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99

1010
func TestNewRouter(t *testing.T) {
1111
var rn = make(map[string]*[]Route)
12+
var px = make(map[string]Route)
1213
tests := []struct {
1314
name string
1415
want Router
@@ -18,6 +19,7 @@ func TestNewRouter(t *testing.T) {
1819
name: "test 1",
1920
want: &ReqRouter{
2021
namedRoutes: rn,
22+
prefixRoutes: px,
2123
},
2224
},
2325
}

0 commit comments

Comments
 (0)