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
265b663b44
commit
139dfbd0e1
|
|
@ -3749,7 +3749,7 @@ func TestCreateTimeout(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
}
|
||||
itemOut := expectApiStatus(t, "POST", server.URL+"/"+prefix+"/"+testGroupVersion.Group+"/"+testGroupVersion.Version+"/namespaces/default/foo?timeout=4ms", data, apierrs.StatusServerTimeout)
|
||||
itemOut := expectApiStatus(t, "POST", server.URL+"/"+prefix+"/"+testGroupVersion.Group+"/"+testGroupVersion.Version+"/namespaces/default/foo?timeout=4ms", data, http.StatusGatewayTimeout)
|
||||
if itemOut.Status != metav1.StatusFailure || itemOut.Reason != metav1.StatusReasonTimeout {
|
||||
t.Errorf("Unexpected status %#v", itemOut)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -511,7 +511,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
|
|||
// http.StatusUnsupportedMediaType, http.StatusNotAcceptable,
|
||||
// http.StatusBadRequest, http.StatusUnauthorized, http.StatusForbidden,
|
||||
// http.StatusRequestTimeout, http.StatusConflict, http.StatusPreconditionFailed,
|
||||
// 422 (StatusUnprocessableEntity), http.StatusInternalServerError,
|
||||
// http.StatusUnprocessableEntity, http.StatusInternalServerError,
|
||||
// http.StatusServiceUnavailable
|
||||
// and api error codes
|
||||
// Note that if we specify a versioned Status object here, we may need to
|
||||
|
|
|
|||
|
|
@ -123,5 +123,5 @@ func WithMaxInFlightLimit(
|
|||
func tooManyRequests(req *http.Request, w http.ResponseWriter) {
|
||||
// Return a 429 status indicating "Too Many Requests"
|
||||
w.Header().Set("Retry-After", retryAfter)
|
||||
http.Error(w, "Too many requests, please try again later.", errors.StatusTooManyRequests)
|
||||
http.Error(w, "Too many requests, please try again later.", http.StatusTooManyRequests)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue