Commit 4f1ca2a3 authored by Andreas Jung's avatar Andreas Jung

Collector #1864, #1906: fixed header normalization in appendHeader()

parent f6fc2508
......@@ -31,6 +31,8 @@ Zope Changes
Bugs Fixed
- Collector #1864, #1906: fixed header normalization in appendHeader()
- Collector #1899: fixed migration issue when using export/import for
ZCatalog instances
......
......@@ -544,7 +544,7 @@ class HTTPResponse(BaseResponse):
Sets an HTTP return header "name" with value "value",
appending it following a comma if there was a previous value
set for the header. '''
name = str(name)
name = str(name).lower()
value = str(value)
headers = self.headers
......
......@@ -65,6 +65,16 @@ class HTTPResponseTests(unittest.TestCase):
self.assertEqual(cookie.get('value'), 'bar:baz')
self.assertEqual(cookie.get('path'), '/')
def test_appendHeader(self):
response = self._makeOne()
response.setHeader('foo', 'bar')
response.appendHeader('foo', 'foo')
self.assertEqual(response.headers.get('foo'), 'bar,\n\tfoo')
response.setHeader('xxx', 'bar')
response.appendHeader('XXX', 'foo')
self.assertEqual(response.headers.get('xxx'), 'bar,\n\tfoo')
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(HTTPResponseTests, 'test'))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment