api: Don't treat 429 as error (#2850)

* api: Don't treat 429 as error

* Added parenthesis
This commit is contained in:
Vishal Nayak 2017-06-12 18:31:36 -04:00 committed by GitHub
parent 3309496916
commit 2d61087b99

View file

@ -25,8 +25,9 @@ func (r *Response) DecodeJSON(out interface{}) error {
// this will fully consume the response body, but will not close it. The
// body must still be closed manually.
func (r *Response) Error() error {
// 200 to 399 are okay status codes
if r.StatusCode >= 200 && r.StatusCode < 400 {
// 200 to 399 are okay status codes. 429 is the code for health status of
// standby nodes.
if (r.StatusCode >= 200 && r.StatusCode < 400) || r.StatusCode == 429 {
return nil
}