From 8633ac180e80da0b9895b4d2475d804fbbde3f35 Mon Sep 17 00:00:00 2001 From: Anders Daljord Morken Date: Wed, 17 Aug 2016 15:16:24 +0200 Subject: [PATCH] Strip stray whitespace from bearer token file Apart from not trying to send a newline in a HTTP header, this also allows Prometheus to build and pass tests with Go 1.7, which features stricter checking of HTTP headers. --- retrieval/target.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retrieval/target.go b/retrieval/target.go index 0c34fb81f..17cdcc3c9 100644 --- a/retrieval/target.go +++ b/retrieval/target.go @@ -98,7 +98,7 @@ func newHTTPClient(cfg *config.ScrapeConfig) (*http.Client, error) { if err != nil { return nil, fmt.Errorf("unable to read bearer token file %s: %s", cfg.BearerTokenFile, err) } - bearerToken = string(b) + bearerToken = strings.TrimSpace(string(b)) } if len(bearerToken) > 0 {