summaryrefslogtreecommitdiff
path: root/service/http/service.go
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-06-13 14:07:58 +0300
committerWolfy-J <[email protected]>2018-06-13 14:07:58 +0300
commit7d77b05901f4b34025a307de2ac4a83ae3162452 (patch)
tree847574125797cb69d444530cbae59cf345cbe415 /service/http/service.go
parentca95f67317bcf8972b9e669869338a7dc09bf06d (diff)
minor refactor
Diffstat (limited to 'service/http/service.go')
-rw-r--r--service/http/service.go10
1 files changed, 4 insertions, 6 deletions
diff --git a/service/http/service.go b/service/http/service.go
index f1712fd2..881c862d 100644
--- a/service/http/service.go
+++ b/service/http/service.go
@@ -11,10 +11,8 @@ import (
// Name contains default svc name.
const Name = "http"
-type middleware interface {
- // Handle must return true if request/response pair is handled withing the mdws.
- Handle(w http.ResponseWriter, r *http.Request) bool
-}
+// must return true if request/response pair is handled withing the middleware.
+type middleware func(w http.ResponseWriter, r *http.Request) bool
// Service manages rr, http servers.
type Service struct {
@@ -101,10 +99,10 @@ func (s *Service) Stop() {
s.http.Shutdown(context.Background())
}
-// Handle handles connection using set of mdws and rr PSR-7 server.
+// middleware handles connection using set of mdws and rr PSR-7 server.
func (s *Service) ServeHTTP(w http.ResponseWriter, r *http.Request) {
for _, m := range s.mdws {
- if m.Handle(w, r) {
+ if m(w, r) {
return
}
}