Skip to content

Commit c0b116b

Browse files
committed
Merge remote-tracking branch 'origin' into ghe-api
2 parents dd0d236 + f486cc4 commit c0b116b

File tree

15 files changed

+795
-614
lines changed

15 files changed

+795
-614
lines changed

api/client.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,13 @@ func (c Client) HasScopes(wantedScopes ...string) (bool, string, error) {
209209
if err != nil {
210210
return false, "", err
211211
}
212-
defer res.Body.Close()
212+
213+
defer func() {
214+
// Ensure the response body is fully read and closed
215+
// before we reconnect, so that we reuse the same TCPconnection.
216+
_, _ = io.Copy(ioutil.Discard, res.Body)
217+
res.Body.Close()
218+
}()
213219

214220
if res.StatusCode != 200 {
215221
return false, "", handleHTTPError(res)

0 commit comments

Comments
 (0)