Skip to content

Commit

Permalink
fixed bug with body close
Browse files Browse the repository at this point in the history
  • Loading branch information
zebox authored and umputun committed May 27, 2021
1 parent 706a4c3 commit 99f2d83
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions provider/apple.go
Expand Up @@ -433,18 +433,18 @@ func (ah *AppleHandler) exchange(ctx context.Context, code, redirectURI string,
return errors.Wrap(err, "unmarshalling data from apple service response failed")
}

// If above operation done successfully checking a response code and error descriptions, if one exist.
// Apple service will response either 200 (OK) or 400 (any error).
if res.StatusCode != http.StatusOK || result.Error != "" {
return fmt.Errorf("apple token service error: %s", result.Error)
}

defer func() {
if err = res.Body.Close(); err != nil {
ah.L.Logf("[ERROR] close request body failed when get access token: %v", err)
}
}()

// If above operation done successfully checking a response code and error descriptions, if one exist.
// Apple service will response either 200 (OK) or 400 (any error).
if res.StatusCode != http.StatusOK || result.Error != "" {
return fmt.Errorf("apple token service error: %s", result.Error)
}

return err
}

Expand Down

0 comments on commit 99f2d83

Please sign in to comment.