Make the registry client more tolerant about HTTP status codes
Generally, all 2xx and 3xx codes should be treated as success. Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
This commit is contained in:
@@ -61,3 +61,9 @@ func handleErrorResponse(resp *http.Response) error {
|
||||
}
|
||||
return &UnexpectedHTTPStatusError{Status: resp.Status}
|
||||
}
|
||||
|
||||
// SuccessStatus returns true if the argument is a successful HTTP response
|
||||
// code (in the range 200 - 399 inclusive).
|
||||
func SuccessStatus(status int) bool {
|
||||
return status >= 200 && status <= 399
|
||||
}
|
||||
|
Reference in New Issue
Block a user