1
0
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:
Evgeniy Kulikov 2018-02-23 22:32:27 +03:00 committed by Vishal Rana
parent 4f3080c197
commit 6da0483447

View File

@ -89,7 +89,7 @@ func TestGzipWithStatic(t *testing.T) {
assert.Equal(t, cl, rec.Body.Len())
}
r, err := gzip.NewReader(rec.Body)
assert.NoError(t, err)
if assert.NoError(t, err) {
defer r.Close()
want, err := ioutil.ReadFile("../_fixture/images/walle.png")
if assert.NoError(t, err) {
@ -98,3 +98,4 @@ func TestGzipWithStatic(t *testing.T) {
assert.Equal(t, want, buf.Bytes())
}
}
}