diff options
author | Wolfy-J <[email protected]> | 2019-12-23 14:43:47 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2019-12-23 14:43:47 +0300 |
commit | c7b0a4a81827284f7565c56aa476eea34fb6382f (patch) | |
tree | ee30e93169c37fb058fbe55af6b3f954eabd9646 /service/headers/service_test.go | |
parent | 7f694966730f6dac09d0d0ea3bf51276b8e4dfe4 (diff) |
- test fixes
Diffstat (limited to 'service/headers/service_test.go')
-rw-r--r-- | service/headers/service_test.go | 56 |
1 files changed, 48 insertions, 8 deletions
diff --git a/service/headers/service_test.go b/service/headers/service_test.go index 250f4458..2f29db5e 100644 --- a/service/headers/service_test.go +++ b/service/headers/service_test.go @@ -59,7 +59,12 @@ func Test_RequestHeaders(t *testing.T) { } }`})) - go func() { c.Serve() }() + go func() { + err := c.Serve() + if err != nil { + t.Errorf("error during Serve: error %v", err) + } + }() time.Sleep(time.Millisecond * 100) defer c.Stop() @@ -68,7 +73,12 @@ func Test_RequestHeaders(t *testing.T) { r, err := http.DefaultClient.Do(req) assert.NoError(t, err) - defer r.Body.Close() + defer func() { + err := r.Body.Close() + if err != nil { + t.Errorf("error during the body closing: error %v", err) + } + }() b, err := ioutil.ReadAll(r.Body) assert.NoError(t, err) @@ -103,7 +113,12 @@ func Test_ResponseHeaders(t *testing.T) { } }`})) - go func() { c.Serve() }() + go func() { + err := c.Serve() + if err != nil { + t.Errorf("error during the Serve: error %v", err) + } + }() time.Sleep(time.Millisecond * 100) defer c.Stop() @@ -112,7 +127,12 @@ func Test_ResponseHeaders(t *testing.T) { r, err := http.DefaultClient.Do(req) assert.NoError(t, err) - defer r.Body.Close() + defer func() { + err := r.Body.Close() + if err != nil { + t.Errorf("error during the body closing: error %v", err) + } + }() assert.Equal(t, "output-header", r.Header.Get("output")) @@ -157,7 +177,12 @@ func TestCORS_OPTIONS(t *testing.T) { } }`})) - go func() { c.Serve() }() + go func() { + err := c.Serve() + if err != nil { + t.Errorf("error during the Serve: error %v", err) + } + }() time.Sleep(time.Millisecond * 100) defer c.Stop() @@ -166,7 +191,12 @@ func TestCORS_OPTIONS(t *testing.T) { r, err := http.DefaultClient.Do(req) assert.NoError(t, err) - defer r.Body.Close() + defer func() { + err := r.Body.Close() + if err != nil { + t.Errorf("error during the body closing: error %v", err) + } + }() assert.Equal(t, "true", r.Header.Get("Access-Control-Allow-Credentials")) assert.Equal(t, "*", r.Header.Get("Access-Control-Allow-Headers")) @@ -215,7 +245,12 @@ func TestCORS_Pass(t *testing.T) { } }`})) - go func() { c.Serve() }() + go func() { + err := c.Serve() + if err != nil { + t.Errorf("error during the Serve: error %v", err) + } + }() time.Sleep(time.Millisecond * 100) defer c.Stop() @@ -224,7 +259,12 @@ func TestCORS_Pass(t *testing.T) { r, err := http.DefaultClient.Do(req) assert.NoError(t, err) - defer r.Body.Close() + defer func() { + err := r.Body.Close() + if err != nil { + t.Errorf("error during the body closing: error %v", err) + } + }() assert.Equal(t, "true", r.Header.Get("Access-Control-Allow-Credentials")) assert.Equal(t, "*", r.Header.Get("Access-Control-Allow-Headers")) |