From 37f96365c297246949c41d4f2adeaa5ed918a1f6 Mon Sep 17 00:00:00 2001 From: stephen mcquay Date: Fri, 30 Jun 2017 16:13:31 -0700 Subject: [PATCH] properly treat response bodies --- fetch.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fetch.go b/fetch.go index b75545a..58b539c 100644 --- a/fetch.go +++ b/fetch.go @@ -2,6 +2,8 @@ package hmm import ( "bufio" + "io" + "io/ioutil" "net/http" ) @@ -23,6 +25,9 @@ func Lines(url string) <-chan string { r <- s.Text() } // ignore errors + // if resp.StatusCode != http.StatusOK {} + io.Copy(ioutil.Discard, resp.Body) + resp.Body.Close() }() return r