diff options
author | Valery Piashchynski <[email protected]> | 2020-12-01 17:54:23 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-12-01 17:54:23 +0300 |
commit | f77ddd3109c300d0429e50bde19f86ea8c4883f8 (patch) | |
tree | df35f9205bedbfd05d16ed0eda8ab60d25c1ca69 /plugins/headers/plugin.go | |
parent | 3805b875c6498a9697c692c010bc022e8ebd50b0 (diff) |
Update CI, prepare to test Headers plugin
Diffstat (limited to 'plugins/headers/plugin.go')
-rw-r--r-- | plugins/headers/plugin.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/plugins/headers/plugin.go b/plugins/headers/plugin.go index 629c0f30..dc0aab5a 100644 --- a/plugins/headers/plugin.go +++ b/plugins/headers/plugin.go @@ -22,7 +22,7 @@ type Plugin struct { // misconfiguration. Services must not be used without proper configuration pushed first. func (s *Plugin) Init(cfg config.Configurer) error { const op = errors.Op("headers plugin init") - err := cfg.UnmarshalKey(RootPluginName, s.cfg) + err := cfg.UnmarshalKey(RootPluginName, &s.cfg) if err != nil { return errors.E(op, err) } @@ -48,11 +48,11 @@ func (s *Plugin) Middleware(next http.Handler) http.HandlerFunc { if s.cfg.Headers.CORS != nil { if r.Method == http.MethodOptions { - s.preflightRequest(w, r) + s.preflightRequest(w) return } - s.corsHeaders(w, r) + s.corsHeaders(w) } next.ServeHTTP(w, r) @@ -64,7 +64,7 @@ func (s *Plugin) Name() string { } // configure OPTIONS response -func (s *Plugin) preflightRequest(w http.ResponseWriter, r *http.Request) { +func (s *Plugin) preflightRequest(w http.ResponseWriter) { headers := w.Header() headers.Add("Vary", "Origin") @@ -95,7 +95,7 @@ func (s *Plugin) preflightRequest(w http.ResponseWriter, r *http.Request) { } // configure CORS headers -func (s *Plugin) corsHeaders(w http.ResponseWriter, r *http.Request) { +func (s *Plugin) corsHeaders(w http.ResponseWriter) { headers := w.Header() headers.Add("Vary", "Origin") |