mirror of
https://github.com/labstack/echo.git
synced 2024-12-24 20:14:31 +02:00
[FIX] We must close gzip.Reader, only if no error (#1069)
* [FIX] We must close gzip.Reader, only if no error * review comments fix
This commit is contained in:
parent
4f3080c197
commit
6da0483447
@ -89,12 +89,13 @@ func TestGzipWithStatic(t *testing.T) {
|
|||||||
assert.Equal(t, cl, rec.Body.Len())
|
assert.Equal(t, cl, rec.Body.Len())
|
||||||
}
|
}
|
||||||
r, err := gzip.NewReader(rec.Body)
|
r, err := gzip.NewReader(rec.Body)
|
||||||
assert.NoError(t, err)
|
|
||||||
defer r.Close()
|
|
||||||
want, err := ioutil.ReadFile("../_fixture/images/walle.png")
|
|
||||||
if assert.NoError(t, err) {
|
if assert.NoError(t, err) {
|
||||||
buf := new(bytes.Buffer)
|
defer r.Close()
|
||||||
buf.ReadFrom(r)
|
want, err := ioutil.ReadFile("../_fixture/images/walle.png")
|
||||||
assert.Equal(t, want, buf.Bytes())
|
if assert.NoError(t, err) {
|
||||||
|
buf := new(bytes.Buffer)
|
||||||
|
buf.ReadFrom(r)
|
||||||
|
assert.Equal(t, want, buf.Bytes())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user