t.current.responseStart = time.Now()
}
-var userAgentDefaultHeader = fmt.Sprintf("BlackBox Exporter/%s", version.Version)
+var userAgentDefaultHeader = fmt.Sprintf("Blackbox Exporter/%s", version.Version)
func ProbeHTTP(ctx context.Context, target string, module config.Module, registry *prometheus.Registry, logger log.Logger) (success bool) {
var redirects int
request.Header.Set(key, value)
}
- if request.Header.Get("User-Agent") == "" {
+ _, hasUserAgent := request.Header["User-Agent"]
+ if !hasUserAgent {
request.Header.Set("User-Agent", userAgentDefaultHeader)
}