From 79715acc5e96d00d24ce1ea708899cd8e441649a Mon Sep 17 00:00:00 2001 From: mprahl Date: Tue, 8 Nov 2022 11:02:48 -0500 Subject: [PATCH] Fix an issue where the /healthz endpoint would not return text on error The status code was correct but the body was always empty. Signed-off-by: mprahl --- main.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/main.go b/main.go index 3edcd768..632123d1 100644 --- a/main.go +++ b/main.go @@ -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)