summaryrefslogtreecommitdiff
path: root/router_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'router_test.go')
-rw-r--r--router_test.go22
1 files changed, 11 insertions, 11 deletions
diff --git a/router_test.go b/router_test.go
index bfc48bd..5430de7 100644
--- a/router_test.go
+++ b/router_test.go
@@ -1,4 +1,4 @@
-package gus_test
+package sliderule_test
import (
"bytes"
@@ -9,24 +9,24 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
- "tildegit.org/tjp/gus"
- "tildegit.org/tjp/gus/gemini"
+ sr "tildegit.org/tjp/sliderule"
+ "tildegit.org/tjp/sliderule/gemini"
)
-var h1 = gus.HandlerFunc(func(_ context.Context, _ *gus.Request) *gus.Response {
+var h1 = sr.HandlerFunc(func(_ context.Context, _ *sr.Request) *sr.Response {
return gemini.Success("", &bytes.Buffer{})
})
-func mw1(h gus.Handler) gus.Handler {
- return gus.HandlerFunc(func(ctx context.Context, req *gus.Request) *gus.Response {
+func mw1(h sr.Handler) sr.Handler {
+ return sr.HandlerFunc(func(ctx context.Context, req *sr.Request) *sr.Response {
resp := h.Handle(ctx, req)
resp.Body = io.MultiReader(resp.Body, bytes.NewBufferString("\nmiddleware 1"))
return resp
})
}
-func mw2(h gus.Handler) gus.Handler {
- return gus.HandlerFunc(func(ctx context.Context, req *gus.Request) *gus.Response {
+func mw2(h sr.Handler) sr.Handler {
+ return sr.HandlerFunc(func(ctx context.Context, req *sr.Request) *sr.Response {
resp := h.Handle(ctx, req)
resp.Body = io.MultiReader(resp.Body, bytes.NewBufferString("\nmiddleware 2"))
return resp
@@ -34,7 +34,7 @@ func mw2(h gus.Handler) gus.Handler {
}
func TestRouterUse(t *testing.T) {
- r := &gus.Router{}
+ r := &sr.Router{}
r.Use(mw1)
r.Use(mw2)
r.Route("/", h1)
@@ -52,10 +52,10 @@ func TestRouterUse(t *testing.T) {
}
func TestRouterMount(t *testing.T) {
- outer := &gus.Router{}
+ outer := &sr.Router{}
outer.Use(mw2)
- inner := &gus.Router{}
+ inner := &sr.Router{}
inner.Use(mw1)
inner.Route("/bar", h1)