From 998037b5b40c1de5fee348ffdea8820509d85171 Mon Sep 17 00:00:00 2001 From: Julien Pivotto Date: Tue, 15 Dec 2020 00:14:43 +0100 Subject: [PATCH] http prober: Fix error checking (#723) Not sure if that can be triggered in real scenarios. Signed-off-by: Julien Pivotto --- prober/http.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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" { -- 2.25.1