From a40368e0f715911efe3645da921d56c169ddb1db Mon Sep 17 00:00:00 2001 From: Bob Callaway Date: Wed, 20 Nov 2024 12:15:03 -0800 Subject: [PATCH] read and discard prober response body 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 }