Skip to content

Commit

Permalink
discard healthcheck body and close it
Browse files Browse the repository at this point in the history
  • Loading branch information
skandragon committed Jan 19, 2022
1 parent 7adabb4 commit 6295db0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions health/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package health
import (
"encoding/json"
"fmt"
"io"
"log"
"net/http"
"sync"
Expand Down Expand Up @@ -198,6 +199,8 @@ func (hc *httpChecker) Check() error {
if err != nil {
return err
}
io.Copy(io.Discard, resp.Body)
defer resp.Body.Close()
if resp.StatusCode >= 200 && resp.StatusCode < 400 {
return nil
}
Expand Down

0 comments on commit 6295db0

Please sign in to comment.