bump(github.com/coreos/go-etcd): d2eb551cc057fdaf9848d6130292187bb1368208

This commit is contained in:
Ben Johnson
2013-12-23 16:01:54 -07:00
parent 51406a3582
commit 6b4f7cf861
2 changed files with 13 additions and 4 deletions

View File

@ -203,9 +203,7 @@ func (c *Client) handleResp(resp *http.Response) (bool, []byte) {
} else if code == http.StatusInternalServerError {
time.Sleep(time.Millisecond * 200)
} else if code == http.StatusOK ||
code == http.StatusCreated ||
code == http.StatusBadRequest {
} else if validHttpStatusCode[code] {
b, err := ioutil.ReadAll(resp.Body)
if err != nil {

View File

@ -20,8 +20,19 @@ type RawResponse struct {
Header http.Header
}
var (
validHttpStatusCode = map[int]bool{
http.StatusCreated: true,
http.StatusOK: true,
http.StatusBadRequest: true,
http.StatusNotFound: true,
http.StatusPreconditionFailed: true,
http.StatusForbidden: true,
}
)
func (rr *RawResponse) toResponse() (*Response, error) {
if rr.StatusCode == http.StatusBadRequest {
if rr.StatusCode != http.StatusOK && rr.StatusCode != http.StatusCreated {
return nil, handleError(rr.Body)
}