@@ -171,8 +171,6 @@ func (p *GitHubProvider) hasOrgAndTeam(accessToken string) (bool, error) {
171171 return false, err
172172 }
173173
174− body, err := ioutil.ReadAll(resp.Body)
175−
176174 if last == 0 {
177175 // link header may not be obtained
178176 // When paging is not required and all data can be retrieved with a single call
@@ -196,10 +194,13 @@ func (p *GitHubProvider) hasOrgAndTeam(accessToken string) (bool, error) {
196194 }
197195 }
198196
199− resp.Body.Close()
197+ body, err := ioutil.ReadAll(resp.Body)
200198 if err != nil {
199+ resp.Body.Close()
201200 return false, err
202201 }
202+ resp.Body.Close()
203+
203204 if resp.StatusCode != 200 {
204205 return false, fmt.Errorf(
205206 "got %d from %q %s", resp.StatusCode, endpoint.String(), body)