From 0c00ff98a3e1f6fda53c6f5ce5dda42967b23de5 Mon Sep 17 00:00:00 2001 From: Christoph Polcin Date: Mon, 27 Oct 2014 16:29:57 +0100 Subject: [PATCH] close body --- client.go | 4 ++-- requests.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client.go b/client.go index c6c5773..f5053b6 100644 --- a/client.go +++ b/client.go @@ -34,7 +34,7 @@ func NewClient(uri string, user string, pw string) *Client { func (c *Client) Connect() error { rs, err := c.options("/") if err == nil { - defer rs.Body.Close() + rs.Body.Close() if rs.StatusCode != 200 || (rs.Header.Get("Dav") == "" && rs.Header.Get("DAV") == "") { return newPathError("Connect", c.root, rs.StatusCode) @@ -134,7 +134,7 @@ func (c *Client) RemoveAll(path string) error { if err != nil { return newPathError("Remove", path, 400) } - defer rs.Body.Close() + rs.Body.Close() if rs.StatusCode == 200 || rs.StatusCode == 404 { return nil diff --git a/requests.go b/requests.go index a562d0a..7b9142c 100644 --- a/requests.go +++ b/requests.go @@ -31,7 +31,7 @@ func (c *Client) mkcol(path string) int { if err != nil { return 400 } - defer rs.Body.Close() + rs.Body.Close() if rs.StatusCode == 201 || rs.StatusCode == 405 { return 201 @@ -112,6 +112,6 @@ func (c *Client) put(path string, stream io.Reader) int { if err != nil { return 400 } - defer rs.Body.Close() + rs.Body.Close() return rs.StatusCode }