mirror of
https://github.com/kubernetes/client-go.git
synced 2025-07-05 19:26:23 +00:00
Update generic errors with the new http package codes
All of these errors are now part of the standard HTTP method. Formalize those into our error types and remove duplication and unclear separation. Kubernetes-commit: d3be1ac92eb644e284915a55fe67942c33f88d4c
This commit is contained in:
parent
55f5a3317c
commit
0103f0d62a
@ -889,7 +889,7 @@ func isTextResponse(resp *http.Response) bool {
|
||||
func checkWait(resp *http.Response) (int, bool) {
|
||||
switch r := resp.StatusCode; {
|
||||
// any 500 error code and 429 can trigger a wait
|
||||
case r == errors.StatusTooManyRequests, r >= 500:
|
||||
case r == http.StatusTooManyRequests, r >= 500:
|
||||
default:
|
||||
return 0, false
|
||||
}
|
||||
|
@ -1130,7 +1130,7 @@ func TestCheckRetryClosesBody(t *testing.T) {
|
||||
return
|
||||
}
|
||||
w.Header().Set("Retry-After", "1")
|
||||
http.Error(w, "Too many requests, please try again later.", apierrors.StatusTooManyRequests)
|
||||
http.Error(w, "Too many requests, please try again later.", http.StatusTooManyRequests)
|
||||
}))
|
||||
defer testServer.Close()
|
||||
|
||||
@ -1204,7 +1204,7 @@ func TestCheckRetryHandles429And5xx(t *testing.T) {
|
||||
return
|
||||
}
|
||||
w.Header().Set("Retry-After", "0")
|
||||
w.WriteHeader([]int{apierrors.StatusTooManyRequests, 500, 501, 504}[count])
|
||||
w.WriteHeader([]int{http.StatusTooManyRequests, 500, 501, 504}[count])
|
||||
count++
|
||||
}))
|
||||
defer testServer.Close()
|
||||
@ -1234,7 +1234,7 @@ func BenchmarkCheckRetryClosesBody(b *testing.B) {
|
||||
return
|
||||
}
|
||||
w.Header().Set("Retry-After", "0")
|
||||
w.WriteHeader(apierrors.StatusTooManyRequests)
|
||||
w.WriteHeader(http.StatusTooManyRequests)
|
||||
}))
|
||||
defer testServer.Close()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user