Skip to content

Commit

Permalink
Merge pull request fatedier#1156 from fatedier/new
Browse files Browse the repository at this point in the history
fix health check unclosed resp body
  • Loading branch information
fatedier authored Mar 25, 2019
2 parents b2b5553 + 9ac8f2a commit 8436326
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions client/health/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (
"context"
"errors"
"fmt"
"io"
"io/ioutil"
"net"
"net/http"
"time"
Expand Down Expand Up @@ -170,6 +172,8 @@ func (monitor *HealthCheckMonitor) doHttpCheck(ctx context.Context) error {
if err != nil {
return err
}
defer resp.Body.Close()
io.Copy(ioutil.Discard, resp.Body)

if resp.StatusCode/100 != 2 {
return fmt.Errorf("do http health check, StatusCode is [%d] not 2xx", resp.StatusCode)
Expand Down

0 comments on commit 8436326

Please sign in to comment.