Skip to content

Commit

Permalink
fixed bugs in prefix routes
Browse files Browse the repository at this point in the history
  • Loading branch information
KenWilliamson committed Feb 1, 2023
1 parent e262d48 commit b291800
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
GRRT (Go Request RouTer) is a direct replacement for the archived gorilla/mux.
It has built-in CORS and Method based routing.


## Replaces gorilla/mux with one line of code

[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=GolangToolKits_grrt&metric=alert_status)](https://sonarcloud.io/dashboard?id=GolangToolKits_grrt)
Expand Down
10 changes: 5 additions & 5 deletions coverage.out
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ github.com/GolangToolKits/grrt/reqRouter.go:214.96,216.36 2 1
github.com/GolangToolKits/grrt/reqRouter.go:221.2,222.27 2 1
github.com/GolangToolKits/grrt/reqRouter.go:216.36,217.32 1 1
github.com/GolangToolKits/grrt/reqRouter.go:217.32,219.4 1 1
github.com/GolangToolKits/grrt/router.go:29.25,32.2 2 1
github.com/GolangToolKits/grrt/router.go:35.46,37.49 2 1
github.com/GolangToolKits/grrt/router.go:40.2,40.12 1 1
github.com/GolangToolKits/grrt/router.go:37.49,39.3 1 1
github.com/GolangToolKits/grrt/router.go:44.72,47.2 2 1
github.com/GolangToolKits/grrt/router.go:29.25,34.2 4 1
github.com/GolangToolKits/grrt/router.go:37.46,39.49 2 1
github.com/GolangToolKits/grrt/router.go:42.2,42.12 1 1
github.com/GolangToolKits/grrt/router.go:39.49,41.3 1 1
github.com/GolangToolKits/grrt/router.go:46.72,49.2 2 1
github.com/GolangToolKits/grrt/reqRoute.go:28.32,32.2 3 1
github.com/GolangToolKits/grrt/reqRoute.go:35.56,36.14 1 1
github.com/GolangToolKits/grrt/reqRoute.go:39.2,39.10 1 1
Expand Down
4 changes: 3 additions & 1 deletion router.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ type Router interface {

// NewRouter NewRouter creates new Router
func NewRouter() Router {
var rtn = ReqRouter{namedRoutes: make(map[string]*[]Route)}
var rtn ReqRouter
rtn.namedRoutes = make(map[string]*[]Route)
rtn.prefixRoutes = make(map[string]Route)
return &rtn
}

Expand Down
2 changes: 2 additions & 0 deletions router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

func TestNewRouter(t *testing.T) {
var rn = make(map[string]*[]Route)
var px = make(map[string]Route)
tests := []struct {
name string
want Router
Expand All @@ -18,6 +19,7 @@ func TestNewRouter(t *testing.T) {
name: "test 1",
want: &ReqRouter{
namedRoutes: rn,
prefixRoutes: px,
},
},
}
Expand Down

0 comments on commit b291800

Please sign in to comment.