bump(github.com/coreos/go-etcd): d2eb551cc057fdaf9848d6130292187bb1368208
This commit is contained in:
@ -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 {
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user