Skip to content

Commit

Permalink
Selectively ignore failure to read the body (#119)
Browse files Browse the repository at this point in the history
If we are writing the response to `/dev/null`, then why both reporting
that it failed? We can still report things like DNS latency and other
useful information.
  • Loading branch information
jabley authored and davecheney committed May 1, 2017
1 parent 4a28aae commit 792375f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ func readResponseBody(req *http.Request, resp *http.Response) string {
msg = color.CyanString("Body read")
}

if _, err := io.Copy(w, resp.Body); err != nil {
if _, err := io.Copy(w, resp.Body); err != nil && w != ioutil.Discard {
log.Fatalf("failed to read response body: %v", err)
}

Expand Down

0 comments on commit 792375f

Please sign in to comment.