diff options
author | Wolfy-J <[email protected]> | 2018-06-11 21:40:31 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2018-06-11 21:40:31 +0300 |
commit | 0c90d76f630831c4356e4d29efae32ce8d773983 (patch) | |
tree | 87a605c0b0b637d1ce1ac7641b12d8707d8c8e60 | |
parent | 5b35d066154437d4a26c1bd8b8e3689b72b36acf (diff) |
no library dependency
-rw-r--r-- | service/http/service.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/service/http/service.go b/service/http/service.go index ba941c7c..ecf7a394 100644 --- a/service/http/service.go +++ b/service/http/service.go @@ -11,7 +11,7 @@ import ( // Name contains default svc name. const Name = "http" -type Middleware interface { +type middleware interface { // Handle must return true if request/response pair is handled withing the middleware. Handle(w http.ResponseWriter, r *http.Request) bool } @@ -20,13 +20,13 @@ type Middleware interface { type Service struct { cfg *Config listeners []func(event int, ctx interface{}) - middleware []Middleware + middleware []middleware rr *roadrunner.Server srv *Server http *http.Server } -func (s *Service) AddMiddleware(m Middleware) { +func (s *Service) AddMiddleware(m middleware) { s.middleware = append(s.middleware, m) } @@ -114,7 +114,6 @@ func (s *Service) ServeHTTP(w http.ResponseWriter, r *http.Request) { func (s *Service) listener(event int, ctx interface{}) { // todo: DIE on server failure - for _, l := range s.listeners { l(event, ctx) } |