|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|
|
|
|
limitations under the License.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
package cli
|
|
|
|
|
package kube
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"bytes"
|
|
|
|
@ -24,19 +24,19 @@ import (
|
|
|
|
|
"strings"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type retryingRoundTripper struct {
|
|
|
|
|
wrapped http.RoundTripper
|
|
|
|
|
type RetryingRoundTripper struct {
|
|
|
|
|
Wrapped http.RoundTripper
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (rt *retryingRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
|
|
|
|
|
func (rt *RetryingRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
|
|
|
|
|
return rt.roundTrip(req, 1, nil)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (rt *retryingRoundTripper) roundTrip(req *http.Request, retry int, prevResp *http.Response) (*http.Response, error) {
|
|
|
|
|
func (rt *RetryingRoundTripper) roundTrip(req *http.Request, retry int, prevResp *http.Response) (*http.Response, error) {
|
|
|
|
|
if retry < 0 {
|
|
|
|
|
return prevResp, nil
|
|
|
|
|
}
|
|
|
|
|
resp, rtErr := rt.wrapped.RoundTrip(req)
|
|
|
|
|
resp, rtErr := rt.Wrapped.RoundTrip(req)
|
|
|
|
|
if rtErr != nil {
|
|
|
|
|
return resp, rtErr
|
|
|
|
|
}
|