Skip to content

Commit

Permalink
read and discard prober response body (#1349)
Browse files Browse the repository at this point in the history
Signed-off-by: Bob Callaway <[email protected]>
  • Loading branch information
bobcallaway authored Nov 20, 2024
1 parent d52cc4e commit 0fb6c1e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/prober/prober.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 0fb6c1e

Please sign in to comment.