mirror of
https://github.com/distribution/distribution
synced 2024-11-06 19:35:52 +01:00
Merge pull request #1772 from runcom/go1.6const
registry: use const for status code 429
This commit is contained in:
commit
4739eabc69
@ -71,10 +71,7 @@ var (
|
||||
Message: "too many requests",
|
||||
Description: `Returned when a client attempts to contact a
|
||||
service too many times`,
|
||||
// FIXME: go1.5 doesn't export http.StatusTooManyRequests while
|
||||
// go1.6 does. Update the hardcoded value to the constant once
|
||||
// Docker updates golang version to 1.6.
|
||||
HTTPStatusCode: 429,
|
||||
HTTPStatusCode: http.StatusTooManyRequests,
|
||||
})
|
||||
)
|
||||
|
||||
|
@ -54,10 +54,7 @@ func parseHTTPErrorResponse(statusCode int, r io.Reader) error {
|
||||
switch statusCode {
|
||||
case http.StatusUnauthorized:
|
||||
return errcode.ErrorCodeUnauthorized.WithMessage(detailsErr.Details)
|
||||
// FIXME: go1.5 doesn't export http.StatusTooManyRequests while
|
||||
// go1.6 does. Update the hardcoded value to the constant once
|
||||
// Docker updates golang version to 1.6.
|
||||
case 429:
|
||||
case http.StatusTooManyRequests:
|
||||
return errcode.ErrorCodeTooManyRequests.WithMessage(detailsErr.Details)
|
||||
default:
|
||||
return errcode.ErrorCodeUnknown.WithMessage(detailsErr.Details)
|
||||
|
Loading…
Reference in New Issue
Block a user