From a917346d2573cbaa3e212d762d236dd3b41703d4 Mon Sep 17 00:00:00 2001 From: Siad Ardroumli Date: Sun, 2 Aug 2020 22:58:42 +0200 Subject: Update service.go --- service/static/service.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'service') diff --git a/service/static/service.go b/service/static/service.go index b824e787..95b99860 100644 --- a/service/static/service.go +++ b/service/static/service.go @@ -36,6 +36,18 @@ func (s *Service) Init(cfg *Config, r *rrhttp.Service) (bool, error) { func (s *Service) middleware(f http.HandlerFunc) http.HandlerFunc { // Define the http.HandlerFunc return func(w http.ResponseWriter, r *http.Request) { + if s.cfg.Request != nil { + for k, v := range s.cfg.Request { + r.Header.Add(k, v) + } + } + + if s.cfg.Response != nil { + for k, v := range s.cfg.Response { + w.Header().Set(k, v) + } + } + if !s.handleStatic(w, r) { f(w, r) } -- cgit v1.2.3