From: Julien Pivotto Date: Mon, 14 Dec 2020 23:14:43 +0000 (+0100) Subject: http prober: Fix error checking (#723) X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=998037b5b40c1de5fee348ffdea8820509d85171;p=blackbox_exporter.git http prober: Fix error checking (#723) Not sure if that can be triggered in real scenarios. Signed-off-by: Julien Pivotto --- diff --git a/prober/http.go b/prober/http.go index 125b508..5452fa1 100644 --- a/prober/http.go +++ b/prober/http.go @@ -412,12 +412,12 @@ func ProbeHTTP(ctx context.Context, target string, module config.Module, registr } request, err := http.NewRequest(httpConfig.Method, targetURL.String(), body) - request.Host = origHost - request = request.WithContext(ctx) if err != nil { level.Error(logger).Log("msg", "Error creating request", "err", err) return } + request.Host = origHost + request = request.WithContext(ctx) for key, value := range httpConfig.Headers { if strings.Title(key) == "Host" {