diff options
-rw-r--r-- | service/http/handler.go | 2 | ||||
-rw-r--r-- | service/http/request.go | 2 | ||||
-rw-r--r-- | service/http/service.go | 28 |
3 files changed, 16 insertions, 16 deletions
diff --git a/service/http/handler.go b/service/http/handler.go index 9e67e5b4..945cd51e 100644 --- a/service/http/handler.go +++ b/service/http/handler.go @@ -51,7 +51,7 @@ func (h *Handler) Listen(l func(event int, ctx interface{})) { h.lsn = l } -// middleware serve using PSR-7 requests passed to underlying application. Attempts to serve static files first if enabled. +// mdwr serve using PSR-7 requests passed to underlying application. Attempts to serve static files first if enabled. func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { // validating request size if h.cfg.MaxRequest != 0 { diff --git a/service/http/request.go b/service/http/request.go index 531a1efd..d733b20c 100644 --- a/service/http/request.go +++ b/service/http/request.go @@ -49,7 +49,7 @@ type Request struct { // Uploads contains list of uploaded files, their names, sized and associations with temporary files. Uploads *Uploads `json:"uploads"` - // Attributes can be set by chained middleware to safely pass value from Golang to PHP. See: GetAttribute, SetAttribute functions. + // Attributes can be set by chained mdwr to safely pass value from Golang to PHP. See: GetAttribute, SetAttribute functions. Attributes map[string]interface{} `json:"attributes"` // request body can be parsedData or []byte diff --git a/service/http/service.go b/service/http/service.go index 679a6cd9..bb75a2c0 100644 --- a/service/http/service.go +++ b/service/http/service.go @@ -24,20 +24,20 @@ type middleware func(f http.HandlerFunc) http.HandlerFunc // Service manages rr, http servers. type Service struct { - cfg *Config - env env.Environment - lsns []func(event int, ctx interface{}) - middleware []middleware - mu sync.Mutex - rr *roadrunner.Server - stopping int32 - srv *Handler - http *http.Server + cfg *Config + env env.Environment + lsns []func(event int, ctx interface{}) + mdwr []middleware + mu sync.Mutex + rr *roadrunner.Server + stopping int32 + srv *Handler + http *http.Server } -// AddMiddleware adds new net/http middleware. +// AddMiddleware adds new net/http mdwr. func (s *Service) AddMiddleware(m middleware) { - s.middleware = append(s.middleware, m) + s.mdwr = append(s.mdwr, m) } // AddListener attaches server event watcher. @@ -111,13 +111,13 @@ func (s *Service) Stop() { s.http.Shutdown(context.Background()) } -// middleware handles connection using set of middleware and rr PSR-7 server. +// mdwr handles connection using set of mdwr and rr PSR-7 server. func (s *Service) ServeHTTP(w http.ResponseWriter, r *http.Request) { r = attributes.Init(r) - // chaining middleware + // chaining mdwr f := s.srv.ServeHTTP - for _, m := range s.middleware { + for _, m := range s.mdwr { f = m(f) } f(w, r) |