Skip to content

Commit

Permalink
Adjust RequestToken StatusCode check
Browse files Browse the repository at this point in the history
* Adjust check for consistency with AccessToken
  • Loading branch information
dghubble committed Sep 13, 2016
1 parent f10d27c commit b0d5c93
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ func (c *Config) RequestToken() (requestToken, requestSecret string, err error)
}
// when err is nil, resp contains a non-nil resp.Body which must be closed
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return "", "", fmt.Errorf("oauth1: Server returned status %d", resp.StatusCode)
}
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return "", "", err
}
if resp.StatusCode != http.StatusOK {
return "", "", fmt.Errorf("oauth1: Server returned status %d", resp.StatusCode)
}
// ParseQuery to decode URL-encoded application/x-www-form-urlencoded body
values, err := url.ParseQuery(string(body))
if err != nil {
Expand Down

0 comments on commit b0d5c93

Please sign in to comment.