Skip to content

Commit 06d7185

Browse files
committed
nicer way to consume response
1 parent 4b83b6f commit 06d7185

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

splunk/splunk.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"encoding/json"
77
"errors"
88
"io"
9+
"io/ioutil"
910
"net/http"
1011
"os"
1112
"time"
@@ -164,9 +165,7 @@ func (c *Client) doRequest(b *bytes.Buffer) error {
164165
switch res.StatusCode {
165166
case 200:
166167
// need to read the reply otherwise the connection hangs
167-
buf := new(bytes.Buffer)
168-
buf.ReadFrom(res.Body)
169-
168+
io.Copy(ioutil.Discard, res.Body)
170169
return nil
171170
default:
172171
// Turn response into string and return it

0 commit comments

Comments
 (0)