Commit c02db82b authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

net/http: don't ignore some errors in tests

to help debug Issue 2651

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5644049
parent 52ebadd3
...@@ -441,7 +441,11 @@ func TestRoundTripGzip(t *testing.T) { ...@@ -441,7 +441,11 @@ func TestRoundTripGzip(t *testing.T) {
} }
if accept == "gzip" { if accept == "gzip" {
rw.Header().Set("Content-Encoding", "gzip") rw.Header().Set("Content-Encoding", "gzip")
gz, _ := gzip.NewWriter(rw) gz, err := gzip.NewWriter(rw)
if err != nil {
t.Errorf("gzip NewWriter: %v", err)
return
}
gz.Write([]byte(responseBody)) gz.Write([]byte(responseBody))
gz.Close() gz.Close()
} else { } else {
...@@ -460,7 +464,11 @@ func TestRoundTripGzip(t *testing.T) { ...@@ -460,7 +464,11 @@ func TestRoundTripGzip(t *testing.T) {
res, err := DefaultTransport.RoundTrip(req) res, err := DefaultTransport.RoundTrip(req)
var body []byte var body []byte
if test.compressed { if test.compressed {
gzip, _ := gzip.NewReader(res.Body) gzip, err := gzip.NewReader(res.Body)
if err != nil {
t.Errorf("%d. gzip NewReader: %v", i, err)
continue
}
body, err = ioutil.ReadAll(gzip) body, err = ioutil.ReadAll(gzip)
res.Body.Close() res.Body.Close()
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment