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:
Kota Tsuyuzaki 2016-02-04 05:18:42 -08:00
parent e6c28c4ac7
commit b173995666
2 changed files with 4 additions and 0 deletions

View File

@ -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 = []

View File

@ -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',