diff --git a/circleci/client/rest/client.go b/circleci/client/rest/client.go index 8b3db2d4..87fefbda 100644 --- a/circleci/client/rest/client.go +++ b/circleci/client/rest/client.go @@ -60,7 +60,21 @@ func (c *Client) NewRequest(method string, u *url.URL, payload interface{}) (req } func (c *Client) DoRequest(req *http.Request, resp interface{}) (statusCode int, err error) { - httpResp, err := c.client.Do(req) + var ( + err error + httpResp *http.Response + retries int = 3 + ) + for retries > 0 { + httpResp, err = c.client.Do(req) + + if err != nil { + retries -= 1 + } else { + break + } + } + if err != nil { return 0, err }