From: Michael Stapelberg Date: Tue, 24 Nov 2015 17:10:48 +0000 (+0100) Subject: http: abort probing when request could not be created X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c085629405b05e6f4bfbc385fb3e1831a0f54da9;p=blackbox_exporter.git http: abort probing when request could not be created As per https://play.golang.org/p/4keb0zznDB, passing a nil http.Request to Client.Do() results in a runtime error. --- diff --git a/http.go b/http.go index 0d1c279..52ccfd4 100644 --- a/http.go +++ b/http.go @@ -48,6 +48,7 @@ func probeHTTP(target string, w http.ResponseWriter, module Module) (success boo request, err := http.NewRequest(config.Method, target, nil) if err != nil { log.Errorf("Error creating request for target %s: %s", target, err) + return } resp, err := client.Do(request)