Merge "Fix best response to return correct status"
This commit is contained in:
commit
f90fe4fb3d
@ -49,7 +49,7 @@ from swift.common.http import is_informational, is_success, is_redirection, \
|
||||
HTTP_BAD_REQUEST, HTTP_NOT_FOUND, HTTP_SERVICE_UNAVAILABLE, \
|
||||
HTTP_INSUFFICIENT_STORAGE, HTTP_UNAUTHORIZED, HTTP_CONTINUE
|
||||
from swift.common.swob import Request, Response, HeaderKeyDict, Range, \
|
||||
HTTPException, HTTPRequestedRangeNotSatisfiable
|
||||
HTTPException, HTTPRequestedRangeNotSatisfiable, HTTPServiceUnavailable
|
||||
from swift.common.request_helpers import strip_sys_meta_prefix, \
|
||||
strip_user_meta_prefix, is_user_meta, is_sys_meta, is_sys_or_user_meta
|
||||
from swift.common.storage_policy import POLICIES
|
||||
@ -1256,10 +1256,9 @@ class Controller(object):
|
||||
quorum_size=quorum_size)
|
||||
|
||||
if not resp:
|
||||
resp = Response(request=req)
|
||||
resp = HTTPServiceUnavailable(request=req)
|
||||
self.app.logger.error(_('%(type)s returning 503 for %(statuses)s'),
|
||||
{'type': server_type, 'statuses': statuses})
|
||||
resp.status = '503 Internal Server Error'
|
||||
|
||||
return resp
|
||||
|
||||
|
@ -579,7 +579,7 @@ class TestFuncs(unittest.TestCase):
|
||||
overrides = {302: 204, 100: 204}
|
||||
resp = base.best_response(req, statuses, reasons, bodies, server_type,
|
||||
headers=headers, overrides=overrides)
|
||||
self.assertEqual(resp.status, '503 Internal Server Error')
|
||||
self.assertEqual(resp.status, '503 Service Unavailable')
|
||||
|
||||
# next make a 404 quorum and make sure the last delete (real) 404
|
||||
# status is the one returned.
|
||||
|
Loading…
Reference in New Issue
Block a user