diff --git a/lib.go b/lib.go index e5649d8..87303c9 100644 --- a/lib.go +++ b/lib.go @@ -16,6 +16,9 @@ type Cli struct { basePath string } +func (c *Cli) SetCli(h *http.Client) { + c.cli = h +} func (c *Cli) BasePath() string { return c.basePath } @@ -60,7 +63,6 @@ func (c *Cli) Do(method string, strurl string, body []byte) (*http.Response, err if err != nil { return nil, err } - defer res.Body.Close() if res.StatusCode >= 400 { return nil, errors.New(fmt.Sprintf("Http return code - %d: %s", res.StatusCode, res.Status)) }