diff options
author | Valery Piashchynski <[email protected]> | 2020-02-28 11:36:57 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-02-28 11:36:57 +0300 |
commit | 107116d6ee3c519959d0ab17b99b22c82fc078a2 (patch) | |
tree | 8b7d6f4ef644121ee68ce70a321be872c64fcc35 /service/http | |
parent | 8240ea02181e80f8ac1347054e50718b4ba18ba0 (diff) |
Test_SSL_Service_Redirect update
Diffstat (limited to 'service/http')
-rw-r--r-- | service/http/ssl_test.go | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/service/http/ssl_test.go b/service/http/ssl_test.go index fc8d5c54..9f7b4bc6 100644 --- a/service/http/ssl_test.go +++ b/service/http/ssl_test.go @@ -171,8 +171,8 @@ func Test_SSL_Service_Redirect(t *testing.T) { t.Errorf("error during the Serve: error %v", err) } }() - time.Sleep(time.Millisecond * 100) - defer c.Stop() + + time.Sleep(time.Second) req, err := http.NewRequest("GET", "http://localhost:6029?hello=world", nil) assert.NoError(t, err) @@ -180,10 +180,7 @@ func Test_SSL_Service_Redirect(t *testing.T) { r, err := sslClient.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) - } + }() assert.NotNil(t, r.TLS) @@ -194,6 +191,12 @@ func Test_SSL_Service_Redirect(t *testing.T) { assert.NoError(t, err) assert.Equal(t, 201, r.StatusCode) assert.Equal(t, "WORLD", string(b)) + + err2 := r.Body.Close() + if err2 != nil { + t.Errorf("fail to close the Body: error %v", err2) + } + c.Stop() } func Test_SSL_Service_Push(t *testing.T) { |