1
0
mirror of https://github.com/labstack/echo.git synced 2024-12-24 20:14:31 +02:00

Fix deferring body close in middleware/compress test (#1063)

This commit is contained in:
ferhat elmas 2018-02-19 17:21:01 +01:00 committed by Vishal Rana
parent 181e11a330
commit 7eec915044

View File

@ -35,8 +35,8 @@ func TestGzip(t *testing.T) {
assert.Equal(t, gzipScheme, rec.Header().Get(echo.HeaderContentEncoding)) assert.Equal(t, gzipScheme, rec.Header().Get(echo.HeaderContentEncoding))
assert.Contains(t, rec.Header().Get(echo.HeaderContentType), echo.MIMETextPlain) assert.Contains(t, rec.Header().Get(echo.HeaderContentType), echo.MIMETextPlain)
r, err := gzip.NewReader(rec.Body) r, err := gzip.NewReader(rec.Body)
defer r.Close()
if assert.NoError(t, err) { if assert.NoError(t, err) {
defer r.Close()
buf := new(bytes.Buffer) buf := new(bytes.Buffer)
buf.ReadFrom(r) buf.ReadFrom(r)
assert.Equal(t, "test", buf.String()) assert.Equal(t, "test", buf.String())