Skip to content

Commit

Permalink
Use Prometheus bearer token only when provided
Browse files Browse the repository at this point in the history
  • Loading branch information
diversario committed Nov 30, 2023
1 parent d38a199 commit 8d33460
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion prometheus/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ func (bat authTransport) RoundTrip(req *http.Request) (*http.Response, error) {
if bat.username != "" {
req.SetBasicAuth(bat.username, bat.password)
}
req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", bat.token))

if bat.token != "" {
req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", bat.token))
}

return bat.Transport.RoundTrip(req)
}

Expand Down

0 comments on commit 8d33460

Please sign in to comment.