Skip to content

Commit

Permalink
incorrect deferred body close fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dselans committed Aug 13, 2018
1 parent 9d50332 commit ace2acc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion checkers/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func (h *HTTP) Status() (interface{}, error) {
if err != nil {
return nil, err
}
defer resp.Body.Close()

// Check if StatusCode matches
if resp.StatusCode != h.Config.StatusCode {
Expand All @@ -81,7 +82,6 @@ func (h *HTTP) Status() (interface{}, error) {
if err != nil {
return nil, fmt.Errorf("Unable to read response body to perform content expectancy check: %v", err)
}
defer resp.Body.Close()

if !strings.Contains(string(data), h.Config.Expect) {
return nil, fmt.Errorf("Received response body '%v' does not contain expected content '%v'",
Expand Down

0 comments on commit ace2acc

Please sign in to comment.