diff options
author | tjpcc <tjp@ctrl-c.club> | 2023-05-02 08:56:10 -0600 |
---|---|---|
committer | tjpcc <tjp@ctrl-c.club> | 2023-05-02 08:56:10 -0600 |
commit | 33d0199bbeb068a45a411c5f8dba77f6574656ad (patch) | |
tree | b345292667871d5e2620d71095604c48368cfb93 | |
parent | ace21031f98f0e7512e39120b5b30b58457efc02 (diff) |
fix tests and examples to match the router.Handler() change
-rw-r--r-- | examples/fileserver/main.go | 2 | ||||
-rw-r--r-- | router_test.go | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/examples/fileserver/main.go b/examples/fileserver/main.go index df5e81d..c374cc4 100644 --- a/examples/fileserver/main.go +++ b/examples/fileserver/main.go @@ -35,7 +35,7 @@ func main() { router := &sr.Router{} router.Route("/*", handler) - handler = sr.HandlerFunc(router.Handler) + handler = router.Handler() _, infoLog, _, errLog := logging.DefaultLoggers() diff --git a/router_test.go b/router_test.go index 5430de7..ebcbce8 100644 --- a/router_test.go +++ b/router_test.go @@ -42,7 +42,7 @@ func TestRouterUse(t *testing.T) { request, err := gemini.ParseRequest(bytes.NewBufferString("/\r\n")) require.Nil(t, err) - response := r.Handler(context.Background(), request) + response := r.Handler().Handle(context.Background(), request) require.NotNil(t, response) body, err := io.ReadAll(response.Body) @@ -64,7 +64,7 @@ func TestRouterMount(t *testing.T) { request, err := gemini.ParseRequest(bytes.NewBufferString("/foo/bar\r\n")) require.Nil(t, err) - response := outer.Handler(context.Background(), request) + response := outer.Handler().Handle(context.Background(), request) require.NotNil(t, response) body, err := io.ReadAll(response.Body) @@ -75,6 +75,6 @@ func TestRouterMount(t *testing.T) { request, err = gemini.ParseRequest(bytes.NewBufferString("/foo\r\n")) require.Nil(t, err) - response = outer.Handler(context.Background(), request) + response = outer.Handler().Handle(context.Background(), request) require.Nil(t, response) } |