diff options
author | Wolfy-J <[email protected]> | 2018-07-07 19:42:31 -0700 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2018-07-07 19:42:31 -0700 |
commit | 806b89a1ac24cf6d173f697c9261eed5efa68c3f (patch) | |
tree | e77ff0d9bdf535881ce553574c42d76240ac11a2 /service/http/service_test.go | |
parent | 98f7ce699b559afd74d4e9d607e64b9a8367d762 (diff) |
new middleware format
Diffstat (limited to 'service/http/service_test.go')
-rw-r--r-- | service/http/service_test.go | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/service/http/service_test.go b/service/http/service_test.go index 02d1c3f0..50836b4b 100644 --- a/service/http/service_test.go +++ b/service/http/service_test.go @@ -253,14 +253,15 @@ func Test_Service_Middleware(t *testing.T) { assert.NotNil(t, s) assert.Equal(t, service.StatusConfigured, st) - s.(*Service).AddMiddleware(func(w http.ResponseWriter, r *http.Request) bool { - if r.URL.Path == "/halt" { - w.WriteHeader(500) - w.Write([]byte("halted")) - return true + s.(*Service).AddMiddleware(func(f http.HandlerFunc) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path == "/halt" { + w.WriteHeader(500) + w.Write([]byte("halted")) + } else { + f(w, r) + } } - - return false }) go func() { c.Serve() }() |