Open
Description
Currently, the Github client only closes the response body which can be seen at https://github.com/google/go-github/blob/master/github/github.go#L557 . The resp.Body.Close() makes the connection available for reuse by others using the same http.Client. It doesn’t close the underlying HTTP or TCP connection.
According to the official Go docs:
https://golang.org/pkg/net/http/#Body
// The http Client and Transport guarantee that Body is always
// non-nil, even on responses without a body or responses with
// a zero-length body. It is the caller's responsibility to
// close Body. The default HTTP client's Transport may not
// reuse HTTP/1.x "keep-alive" TCP connections if the Body is
// not read to completion and closed.
My proposal to solve the issue:
- Read until Response is complete (i.e. ioutil.ReadAll(resp.Body) or similar)
- Call Body.Close()