Skip to content

Commit b0d5c93

Browse files
committed
Adjust RequestToken StatusCode check
* Adjust check for consistency with AccessToken
1 parent f10d27c commit b0d5c93

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ func (c *Config) RequestToken() (requestToken, requestSecret string, err error)
7474
}
7575
// when err is nil, resp contains a non-nil resp.Body which must be closed
7676
defer resp.Body.Close()
77+
if resp.StatusCode != http.StatusOK {
78+
return "", "", fmt.Errorf("oauth1: Server returned status %d", resp.StatusCode)
79+
}
7780
body, err := ioutil.ReadAll(resp.Body)
7881
if err != nil {
7982
return "", "", err
8083
}
81-
if resp.StatusCode != http.StatusOK {
82-
return "", "", fmt.Errorf("oauth1: Server returned status %d", resp.StatusCode)
83-
}
8484
// ParseQuery to decode URL-encoded application/x-www-form-urlencoded body
8585
values, err := url.ParseQuery(string(body))
8686
if err != nil {

0 commit comments

Comments
 (0)