@@ -41,9 +41,11 @@ func TestCorsHandler(t *testing.T) {
41
41
url := "http://" + srv .listenAddr ()
42
42
43
43
resp := rpcRequest (t , url , "origin" , "test.com" )
44
+ defer resp .Body .Close ()
44
45
assert .Equal (t , "test.com" , resp .Header .Get ("Access-Control-Allow-Origin" ))
45
46
46
47
resp2 := rpcRequest (t , url , "origin" , "bad" )
48
+ defer resp2 .Body .Close ()
47
49
assert .Equal (t , "" , resp2 .Header .Get ("Access-Control-Allow-Origin" ))
48
50
}
49
51
@@ -54,9 +56,11 @@ func TestVhosts(t *testing.T) {
54
56
url := "http://" + srv .listenAddr ()
55
57
56
58
resp := rpcRequest (t , url , "host" , "test" )
59
+ defer resp .Body .Close ()
57
60
assert .Equal (t , resp .StatusCode , http .StatusOK )
58
61
59
62
resp2 := rpcRequest (t , url , "host" , "bad" )
63
+ defer resp2 .Body .Close ()
60
64
assert .Equal (t , resp2 .StatusCode , http .StatusForbidden )
61
65
}
62
66
@@ -269,6 +273,7 @@ func wsRequest(t *testing.T, url, browserOrigin string) error {
269
273
if browserOrigin != "" {
270
274
headers .Set ("Origin" , browserOrigin )
271
275
}
276
+ //nolint
272
277
conn , _ , err := websocket .DefaultDialer .Dial (url , headers )
273
278
if conn != nil {
274
279
conn .Close ()
@@ -293,6 +298,7 @@ func testCustomRequest(t *testing.T, srv *httpServer, method string) bool {
293
298
if err != nil {
294
299
return false
295
300
}
301
+ defer resp .Body .Close ()
296
302
respBody , err := ioutil .ReadAll (resp .Body )
297
303
assert .NoError (t , err )
298
304
0 commit comments