Skip to content

Commit

Permalink
Fix an issue where the /healthz endpoint would not return text on error
Browse files Browse the repository at this point in the history
The status code was correct but the body was always empty.

Signed-off-by: mprahl <mprahl@users.noreply.github.com>
  • Loading branch information
mprahl authored and openshift-merge-robot committed Nov 8, 2022
1 parent 2d0e518 commit 79715ac
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -528,9 +528,7 @@ func startHealthProxy(ctx context.Context, wg *sync.WaitGroup, addresses ...stri
defer resp.Body.Close()

if resp.StatusCode != http.StatusOK {
body := []byte{}

_, err = resp.Body.Read(body)
body, err := io.ReadAll(resp.Body)
if err != nil {
http.Error(w, "not ok", resp.StatusCode)

Expand Down

0 comments on commit 79715ac

Please sign in to comment.