You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// If the returned error is nil, the Response will contain a non-nil
// Body which the user is expected to close. If the Body is not both
// read to EOF and closed, the Client's underlying RoundTripper
// (typically Transport) may not be able to re-use a persistent TCP
// connection to the server for a subsequent "keep-alive" request.
In the report method, if the response code is <300 the client doesn't read the response body causing connections to get closed by servers.
Simple fix would be to add the line: ioutil.ReadAll(res.Body)
in the condition block.
The text was updated successfully, but these errors were encountered:
I can also confirm that this is an issue. I was seeing an error from this package:
ERROR: sending request - Post "https://api.segment.io/v1/batch": write on closed buffer
Which I resolved by forking this repo and adding io.Copy(ioutil.Discard, resp.Body) to discard the body in the block where the response body is not currently being read.
The http.Do function documentation states that:
In the report method, if the response code is <300 the client doesn't read the response body causing connections to get closed by servers.
Simple fix would be to add the line:
ioutil.ReadAll(res.Body)
in the condition block.
The text was updated successfully, but these errors were encountered: