Fix missing Accept-Ranges
Since commit 4f2ed8bcd0
, the response
header for GET EC object doesn't include the Accept-Ranges header.
This patch fixes it and also adds a few unittests to prevent regression.
Closes-Bug: #1542168
Change-Id: Ibafe56ac87b14bc0028953e620a653cd68dd3f84
This commit is contained in:
parent
e6c28c4ac7
commit
b173995666
@ -2057,6 +2057,7 @@ class ECObjectController(BaseObjectController):
|
||||
headers=resp_headers,
|
||||
conditional_response=True,
|
||||
app_iter=app_iter)
|
||||
resp.accept_ranges = 'bytes'
|
||||
app_iter.kickoff(req, resp)
|
||||
else:
|
||||
statuses = []
|
||||
|
@ -390,6 +390,7 @@ class BaseObjectControllerMixin(object):
|
||||
with set_http_connect(200):
|
||||
resp = req.get_response(self.app)
|
||||
self.assertEqual(resp.status_int, 200)
|
||||
self.assertIn('Accept-Ranges', resp.headers)
|
||||
|
||||
def test_HEAD_x_newest(self):
|
||||
req = swift.common.swob.Request.blank('/v1/a/c/o', method='HEAD',
|
||||
@ -693,6 +694,7 @@ class TestReplicatedObjController(BaseObjectControllerMixin,
|
||||
with set_http_connect(200):
|
||||
resp = req.get_response(self.app)
|
||||
self.assertEqual(resp.status_int, 200)
|
||||
self.assertIn('Accept-Ranges', resp.headers)
|
||||
|
||||
def test_GET_error(self):
|
||||
req = swift.common.swob.Request.blank('/v1/a/c/o')
|
||||
@ -1173,6 +1175,7 @@ class TestECObjController(BaseObjectControllerMixin, unittest.TestCase):
|
||||
with set_http_connect(*get_resp):
|
||||
resp = req.get_response(self.app)
|
||||
self.assertEqual(resp.status_int, 200)
|
||||
self.assertIn('Accept-Ranges', resp.headers)
|
||||
|
||||
def test_GET_simple_x_newest(self):
|
||||
req = swift.common.swob.Request.blank('/v1/a/c/o',
|
||||
|
Loading…
Reference in New Issue
Block a user