diff --git a/prometheus/http.go b/prometheus/http.go index 3d47a81..4d08154 100644 --- a/prometheus/http.go +++ b/prometheus/http.go @@ -115,7 +115,7 @@ func decorateWriter(request *http.Request, writer io.Writer) (io.Writer, string) header := request.Header.Get(acceptEncodingHeader) parts := strings.Split(header, ",") for _, part := range parts { - part := strings.TrimSpace(part) + part = strings.TrimSpace(part) if part == "gzip" || strings.HasPrefix(part, "gzip;") { return gzip.NewWriter(writer), "gzip" } diff --git a/prometheus/http_test.go b/prometheus/http_test.go index edd47ad..dd89ccf 100644 --- a/prometheus/http_test.go +++ b/prometheus/http_test.go @@ -47,9 +47,9 @@ func TestInstrumentHandler(t *testing.T) { instant := time.Now() end := instant.Add(30 * time.Second) now = nowSeries(instant, end) - respBody := respBody("Howdy there!") + body := respBody("Howdy there!") - hndlr := InstrumentHandler("test-handler", respBody) + hndlr := InstrumentHandler("test-handler", body) opts := SummaryOpts{ Subsystem: "http", diff --git a/prometheus/promhttp/http.go b/prometheus/promhttp/http.go index 8dc2603..0135737 100644 --- a/prometheus/promhttp/http.go +++ b/prometheus/promhttp/http.go @@ -302,7 +302,7 @@ func decorateWriter(request *http.Request, writer io.Writer, compressionDisabled header := request.Header.Get(acceptEncodingHeader) parts := strings.Split(header, ",") for _, part := range parts { - part := strings.TrimSpace(part) + part = strings.TrimSpace(part) if part == "gzip" || strings.HasPrefix(part, "gzip;") { return gzip.NewWriter(writer), "gzip" }