client/services: close body after checking for error
-// Copyright 2016 tsuru authors. All rights reserved.
+// Copyright 2017 tsuru authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
@@ -625,10 +625,10 @@ func removeServiceInstanceWithUnbind(ctx *cmd.Context, client *cmd.Client) error
return err
}
resp, err := client.Do(request)
- defer resp.Body.Close()
if err != nil {
return err
}
+ defer resp.Body.Close()
err = cmd.StreamJSONResponse(ctx.Stdout, resp)
if err != nil {
return err
