diff --git a/splunk/splunk.go b/splunk/splunk.go index 6301365..b1c6dae 100644 --- a/splunk/splunk.go +++ b/splunk/splunk.go @@ -158,6 +158,9 @@ func (c *Client) doRequest(b *bytes.Buffer) error { return err } + // need to make sure we close the body to avoid hanging the connection + defer res.Body.Close() + // If statusCode is not good, return error string switch res.StatusCode { case 200: