diff options
author | Valery Piashchynski <[email protected]> | 2021-04-28 14:10:27 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-04-28 14:10:27 +0300 |
commit | 30c25f17fa7d6386e33a4894c812f7ca5db990ad (patch) | |
tree | 03f53535addf71a81eca4b9a1d3ba29d4ebf4984 /tests/plugins/http/plugin_middleware.go | |
parent | 4cb2247f909d02c922edb6f8e3d3741cc5a2c077 (diff) |
- Fix middleware order
- Update tests
- Move worker handler into a separate folder with separate package name
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'tests/plugins/http/plugin_middleware.go')
-rw-r--r-- | tests/plugins/http/plugin_middleware.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/plugins/http/plugin_middleware.go b/tests/plugins/http/plugin_middleware.go index 00640b69..9f04d6db 100644 --- a/tests/plugins/http/plugin_middleware.go +++ b/tests/plugins/http/plugin_middleware.go @@ -18,8 +18,8 @@ func (p *PluginMiddleware) Init(cfg config.Configurer) error { } // Middleware test -func (p *PluginMiddleware) Middleware(next http.Handler) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { +func (p *PluginMiddleware) Middleware(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if r.URL.Path == "/halt" { w.WriteHeader(500) _, err := w.Write([]byte("halted")) @@ -29,7 +29,7 @@ func (p *PluginMiddleware) Middleware(next http.Handler) http.HandlerFunc { } else { next.ServeHTTP(w, r) } - } + }) } // Name test @@ -49,8 +49,8 @@ func (p *PluginMiddleware2) Init(cfg config.Configurer) error { } // Middleware test -func (p *PluginMiddleware2) Middleware(next http.Handler) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { +func (p *PluginMiddleware2) Middleware(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if r.URL.Path == "/boom" { w.WriteHeader(555) _, err := w.Write([]byte("boom")) @@ -60,7 +60,7 @@ func (p *PluginMiddleware2) Middleware(next http.Handler) http.HandlerFunc { } else { next.ServeHTTP(w, r) } - } + }) } // Name test |