# the appearance that HTTPHeaders is a single container.
__copy__ = copy
+ def __str__(self):
+ lines = []
+ for name, value in self.get_all():
+ lines.append("%s: %s" % (name, value))
+ return "\n%s\n" % ("\n".join(lines))
+
+ __unicode__ = __str__
+
class HTTPServerRequest(object):
"""A single HTTP request.
self.assertEqual(headers['quux'], 'xyzzy')
self.assertEqual(sorted(headers.get_all()), [('Foo', 'bar'), ('Quux', 'xyzzy')])
+ def test_string(self):
+ headers = HTTPHeaders()
+ headers.add("Foo", "1")
+ headers.add("Foo", "2")
+ headers.add("Foo", "3")
+ headers2 = HTTPHeaders.parse(str(headers))
+ self.assertEquals(headers, headers2)
+
class FormatTimestampTest(unittest.TestCase):
# Make sure that all the input types are supported.