From b5fff09b543d2caeff10fe0c8a5a4ee10d3c9db9 Mon Sep 17 00:00:00 2001 From: Peter Hellberg Date: Sat, 9 May 2015 21:45:28 +0200 Subject: [PATCH] headers: Changed Rule.Url to Rule.Path Updated ServeHTTP comment to indicate that it is setting headers and not adding them to existing values. --- middleware/headers/headers.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/middleware/headers/headers.go b/middleware/headers/headers.go index 7e3d6dbbd..e71e9fe34 100644 --- a/middleware/headers/headers.go +++ b/middleware/headers/headers.go @@ -18,10 +18,10 @@ type Headers struct { } // ServeHTTP implements the middleware.Handler interface and serves requests, -// adding headers to the response according to the configured rules. +// setting headers on the response according to the configured rules. func (h Headers) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) { for _, rule := range h.Rules { - if middleware.Path(r.URL.Path).Matches(rule.Url) { + if middleware.Path(r.URL.Path).Matches(rule.Path) { for _, header := range rule.Headers { if strings.HasPrefix(header.Name, "-") { w.Header().Del(strings.TrimLeft(header.Name, "-")) @@ -38,7 +38,7 @@ type ( // Rule groups a slice of HTTP headers by a URL pattern. // TODO: use http.Header type instead? Rule struct { - Url string + Path string Headers []Header }