Skip to content

Commit

Permalink
Merge pull request #12 from apinnecke/master
Browse files Browse the repository at this point in the history
fixed response code handling
  • Loading branch information
dghubble authored Sep 30, 2016
2 parents 955bdf2 + 335396d commit 4385816
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ 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 {
if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated {
return "", "", fmt.Errorf("oauth1: Server returned status %d", resp.StatusCode)
}
body, err := ioutil.ReadAll(resp.Body)
Expand Down Expand Up @@ -151,7 +151,7 @@ func (c *Config) AccessToken(requestToken, requestSecret, verifier string) (acce
}
// when err is nil, resp contains a non-nil resp.Body which must be closed
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated {
return "", "", fmt.Errorf("oauth1: Server returned status %d", resp.StatusCode)
}
body, err := ioutil.ReadAll(resp.Body)
Expand Down

0 comments on commit 4385816

Please sign in to comment.