summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorSiad Ardroumli <[email protected]>2020-08-02 22:58:42 +0200
committerGitHub <[email protected]>2020-08-02 22:58:42 +0200
commita917346d2573cbaa3e212d762d236dd3b41703d4 (patch)
treee9cf64984f65bd86db9cb335c518aa929bf29eca /service
parent8d67df09bcf5a9cac1bc2f21045c8620f030554a (diff)
Update service.go
Diffstat (limited to 'service')
-rw-r--r--service/static/service.go12
1 files changed, 12 insertions, 0 deletions
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)
}