diff options
Diffstat (limited to 'router_test.go')
-rw-r--r-- | router_test.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/router_test.go b/router_test.go index 6f9c915..bfc48bd 100644 --- a/router_test.go +++ b/router_test.go @@ -13,24 +13,24 @@ import ( "tildegit.org/tjp/gus/gemini" ) -func h1(_ context.Context, _ *gus.Request) *gus.Response { +var h1 = gus.HandlerFunc(func(_ context.Context, _ *gus.Request) *gus.Response { return gemini.Success("", &bytes.Buffer{}) -} +}) func mw1(h gus.Handler) gus.Handler { - return func(ctx context.Context, req *gus.Request) *gus.Response { - resp := h(ctx, req) + return gus.HandlerFunc(func(ctx context.Context, req *gus.Request) *gus.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 func(ctx context.Context, req *gus.Request) *gus.Response { - resp := h(ctx, req) + return gus.HandlerFunc(func(ctx context.Context, req *gus.Request) *gus.Response { + resp := h.Handle(ctx, req) resp.Body = io.MultiReader(resp.Body, bytes.NewBufferString("\nmiddleware 2")) return resp - } + }) } func TestRouterUse(t *testing.T) { |