fix #4, properly close unused resp body
diff --git a/digest_auth_client.go b/digest_auth_client.go
index 255c522..2058e39 100644
--- a/digest_auth_client.go
+++ b/digest_auth_client.go
@@ -89,6 +89,7 @@
return dr.executeNewDigest(resp)
}
+ // return the resp to user to handle resp.body.Close()
return resp, nil
}
@@ -99,6 +100,9 @@
waString string
)
+ // body not required for authentication, closing
+ resp.Body.Close()
+
if waString = resp.Header.Get("WWW-Authenticate"); waString == "" {
return nil, fmt.Errorf("failed to get WWW-Authenticate header, please check your server configuration")
}