summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2020-02-28 01:04:59 +0300
committerValery Piashchynski <[email protected]>2020-02-28 01:04:59 +0300
commit967d9959602537492adcd2f7216017fda5cc8308 (patch)
tree3b0ddc6a4354715db3c18980fd35b30a6ff4a8ea /service
parentb131206a5ccce508cdf040e622c134c77ef6a33a (diff)
Test_Service_Echo remove defers
Diffstat (limited to 'service')
-rw-r--r--service/http/service_test.go14
1 files changed, 6 insertions, 8 deletions
diff --git a/service/http/service_test.go b/service/http/service_test.go
index c4b2c2c4..a1aecd24 100644
--- a/service/http/service_test.go
+++ b/service/http/service_test.go
@@ -146,26 +146,24 @@ func Test_Service_Echo(t *testing.T) {
}
}()
time.Sleep(time.Millisecond * 100)
- defer c.Stop()
req, err := http.NewRequest("GET", "http://localhost:6029?hello=world", nil)
assert.NoError(t, err)
r, err := http.DefaultClient.Do(req)
assert.NoError(t, err)
- defer func() {
- err := r.Body.Close()
- if err != nil {
- t.Errorf("error closing the Body: error %v", err)
- }
- }()
-
b, err := ioutil.ReadAll(r.Body)
assert.NoError(t, err)
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("error closing the Body: error %v", err2)
+ }
+ c.Stop()
}
func Test_Service_Env(t *testing.T) {