summaryrefslogtreecommitdiff
path: root/service/http/service_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'service/http/service_test.go')
-rw-r--r--service/http/service_test.go15
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() }()