Skip to content

Commit

Permalink
Merge pull request #20 from andygrunwald/cleanup_status_code
Browse files Browse the repository at this point in the history
Use http.StatusConflict instead of hard coded value in SubmitChange
  • Loading branch information
opalmer committed Oct 12, 2016
2 parents b7d35b4 + a4121ca commit 075ba1b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ first. For more complete details see

### 0.1.1 (not yet released)

* Minor fix to SubmitChange to use the `http.StatusConflict` constant
instead of a hard coded value when comparing response codes.

### 0.1.0

Expand Down
3 changes: 2 additions & 1 deletion changes.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"io/ioutil"
"net/http"
)

// ChangesService contains Change related REST endpoints
Expand Down Expand Up @@ -687,7 +688,7 @@ func (s *ChangesService) SubmitChange(changeID string, input *SubmitInput) (*Cha
v := new(ChangeInfo)

resp, err := s.client.Do(req, v)
if 409 == resp.StatusCode {
if resp.StatusCode == http.StatusConflict {
body, _ := ioutil.ReadAll(resp.Body)
err = errors.New(string(body[:]))
}
Expand Down

0 comments on commit 075ba1b

Please sign in to comment.