Skip to content
This repository has been archived by the owner on Apr 11, 2021. It is now read-only.

Commit

Permalink
Beeping now doesn't follow redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
jimen0 authored and yanc0 committed Jun 13, 2017
1 parent 2559da6 commit 50b06cf
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions beeping.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,18 +230,24 @@ func CheckHTTP(check *Check) (*Response, error) {

timeout := time.Duration(check.Timeout * time.Second)

client := &http.Client{Transport: tr, Timeout: timeout}
client := &http.Client{
Transport: tr,
Timeout: timeout,
CheckRedirect: func(req *http.Request, via []*http.Request) error {
return http.ErrUseLastResponse
},
}
res, err := client.Do(req)
if err != nil {
return nil, err
}
defer res.Body.Close()

body, err := ioutil.ReadAll(res.Body)
if err != nil {
return nil, err
}

res.Body.Close()
timeEndBody := time.Now()
result.End(timeEndBody)
var total = result.Total(timeEndBody)
Expand Down

0 comments on commit 50b06cf

Please sign in to comment.