Browse Source

symlink: Ensure headers are returned as a list on py3

Change-Id: Ic2f4487b6caf81fef3455ce03dda2cc144ae24ec
Related-Bug: #1929083
Co-Authored-By: Walter Doekes <walter+github@wjd.nu>
(cherry picked from commit 6bfd93d886)
changes/62/792662/1
Tim Burke 4 weeks ago
committed by Tim Burke
parent
commit
fa6edcc7e6
2 changed files with 2 additions and 1 deletions
  1. +1
    -1
      swift/common/middleware/symlink.py
  2. +1
    -0
      test/unit/common/middleware/test_symlink.py

+ 1
- 1
swift/common/middleware/symlink.py View File

@ -417,7 +417,7 @@ class SymlinkObjectContext(WSGIContext):
resp = self._app_call(req.environ)
response_header_dict = HeaderKeyDict(self._response_headers)
symlink_sysmeta_to_usermeta(response_header_dict)
self._response_headers = response_header_dict.items()
self._response_headers = list(response_header_dict.items())
return resp
def handle_get_head(self, req):


+ 1
- 0
test/unit/common/middleware/test_symlink.py View File

@ -360,6 +360,7 @@ class TestSymlinkMiddleware(TestSymlinkMiddlewareBase):
req = Request.blank('/v1/a/c/symlink?symlink=get', method='GET')
status, headers, body = self.call_sym(req)
self.assertEqual(status, '200 OK')
self.assertIsInstance(headers, list)
self.assertIn(('X-Symlink-Target', 'c1/o'), headers)
self.assertNotIn('X-Symlink-Target-Account', dict(headers))


Loading…
Cancel
Save