4
4
"bytes"
5
5
"compress/gzip"
6
6
"errors"
7
- "io/ioutil "
7
+ "io"
8
8
"net/http"
9
9
"net/http/httptest"
10
10
"strings"
@@ -39,7 +39,7 @@ func TestDecompress(t *testing.T) {
39
39
c = e .NewContext (req , rec )
40
40
h (c )
41
41
assert .Equal (t , GZIPEncoding , req .Header .Get (echo .HeaderContentEncoding ))
42
- b , err := ioutil .ReadAll (req .Body )
42
+ b , err := io .ReadAll (req .Body )
43
43
assert .NoError (t , err )
44
44
assert .Equal (t , body , string (b ))
45
45
}
@@ -67,7 +67,7 @@ func TestDecompressDefaultConfig(t *testing.T) {
67
67
c = e .NewContext (req , rec )
68
68
h (c )
69
69
assert .Equal (t , GZIPEncoding , req .Header .Get (echo .HeaderContentEncoding ))
70
- b , err := ioutil .ReadAll (req .Body )
70
+ b , err := io .ReadAll (req .Body )
71
71
assert .NoError (t , err )
72
72
assert .Equal (t , body , string (b ))
73
73
}
@@ -82,7 +82,7 @@ func TestCompressRequestWithoutDecompressMiddleware(t *testing.T) {
82
82
e .NewContext (req , rec )
83
83
e .ServeHTTP (rec , req )
84
84
assert .Equal (t , GZIPEncoding , req .Header .Get (echo .HeaderContentEncoding ))
85
- b , err := ioutil .ReadAll (req .Body )
85
+ b , err := io .ReadAll (req .Body )
86
86
assert .NoError (t , err )
87
87
assert .NotEqual (t , b , body )
88
88
assert .Equal (t , b , gz )
@@ -132,7 +132,7 @@ func TestDecompressSkipper(t *testing.T) {
132
132
c := e .NewContext (req , rec )
133
133
e .ServeHTTP (rec , req )
134
134
assert .Equal (t , rec .Header ().Get (echo .HeaderContentType ), echo .MIMEApplicationJSONCharsetUTF8 )
135
- reqBody , err := ioutil .ReadAll (c .Request ().Body )
135
+ reqBody , err := io .ReadAll (c .Request ().Body )
136
136
assert .NoError (t , err )
137
137
assert .Equal (t , body , string (reqBody ))
138
138
}
@@ -161,7 +161,7 @@ func TestDecompressPoolError(t *testing.T) {
161
161
c := e .NewContext (req , rec )
162
162
e .ServeHTTP (rec , req )
163
163
assert .Equal (t , GZIPEncoding , req .Header .Get (echo .HeaderContentEncoding ))
164
- reqBody , err := ioutil .ReadAll (c .Request ().Body )
164
+ reqBody , err := io .ReadAll (c .Request ().Body )
165
165
assert .NoError (t , err )
166
166
assert .Equal (t , body , string (reqBody ))
167
167
assert .Equal (t , rec .Code , http .StatusInternalServerError )
0 commit comments