summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2020-02-28 00:25:52 +0300
committerValery Piashchynski <[email protected]>2020-02-28 00:25:52 +0300
commit490114908c8017c542cf073bdad814687ab3e4b9 (patch)
tree672aab7d8f56d2638688fab61af960651e5b87cb /service
parent69ee8c03d58bb8eff74ced36b849295f316ee61b (diff)
H2C test update
Diffstat (limited to 'service')
-rw-r--r--service/http/h2c_test.go17
1 files changed, 8 insertions, 9 deletions
diff --git a/service/http/h2c_test.go b/service/http/h2c_test.go
index 7bbc30ac..a2465a0a 100644
--- a/service/http/h2c_test.go
+++ b/service/http/h2c_test.go
@@ -52,16 +52,15 @@ func Test_Service_H2C(t *testing.T) {
req.Header.Add("Connection", "HTTP2-Settings")
req.Header.Add("HTTP2-Settings", "")
- r, err := http.DefaultClient.Do(req)
- assert.NoError(t, err)
- defer func() {
- err := r.Body.Close()
- if err != nil {
- t.Errorf("fail to close the Body: error %v", err)
- }
- }()
+ r, err2 := http.DefaultClient.Do(req)
+ if err2 != nil {
+ t.Fatal(err2)
+ }
assert.Equal(t, "101 Switching Protocols", r.Status)
- // will fail with h2c notice
+ err3 := r.Body.Close()
+ if err3 != nil {
+ t.Errorf("fail to close the Body: error %v", err3)
+ }
}