mirror of
https://github.com/golang/go
synced 2024-11-24 23:07:56 -07:00
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
This commit is contained in:
parent
52ebadd356
commit
c02db82b83
@ -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) {
|
|||||||
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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user