mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-27 22:49:40 -08:00
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.
This commit is contained in:
parent
54c0b10abb
commit
8633ac180e
|
@ -98,7 +98,7 @@ func newHTTPClient(cfg *config.ScrapeConfig) (*http.Client, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to read bearer token file %s: %s", cfg.BearerTokenFile, err)
|
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 {
|
if len(bearerToken) > 0 {
|
||||||
|
|
Loading…
Reference in a new issue