From 0fb6c1e4d34c1d40f58a00da8380b7d5fa65a04c Mon Sep 17 00:00:00 2001 From: Bob Callaway Date: Wed, 20 Nov 2024 13:09:20 -0800 Subject: [PATCH] read and discard prober response body (#1349) Signed-off-by: Bob Callaway --- cmd/prober/prober.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/prober/prober.go b/cmd/prober/prober.go index f95e7f350..ba0b54aba 100644 --- a/cmd/prober/prober.go +++ b/cmd/prober/prober.go @@ -303,6 +303,12 @@ func observeRequest(host string, r ReadProberCheck) error { sloEndpoint = r.Endpoint } exportDataToPrometheus(resp, host, sloEndpoint, r.Method, latency) + + // right we're not doing anything with the body, but let's at least read it all from the server + if _, err := io.Copy(io.Discard, resp.Body); err != nil { + return fmt.Errorf("error reading response: %w", err) + } + return nil }