summaryrefslogtreecommitdiff
path: root/router_test.go
diff options
context:
space:
mode:
authortjpcc <tjp@ctrl-c.club>2023-05-01 07:56:25 -0600
committertjpcc <tjp@ctrl-c.club>2023-05-01 07:56:25 -0600
commit9a2da81b11ad0064cca24ce7974827d032309369 (patch)
tree4313224dc089208423e78bffc3ec50833e35bcea /router_test.go
parent21e2758145d100d74013060f7090d84679cae683 (diff)
name change gus -> sliderule
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)