add tests for multiple headers with same name

This commit is contained in:
Mohammadtaher Abbasi 2022-06-11 23:51:34 +04:30
parent e2769cfe48
commit ddfd192b70
1 changed files with 7 additions and 0 deletions

View File

@ -38,6 +38,13 @@ class HeadersTest(unittest.TestCase):
self.assertEqual(h.getlist('X-Forwarded-For'), [b'ip1', b'ip2'])
assert h.getlist('X-Forwarded-For') is not hlist
def test_multivalue_for_one_header(self):
h = Headers((("a", "b"), ("a", "c")))
self.assertEqual(h["a"], b"c")
self.assertEqual(h.get("a"), b"c")
self.assertEqual(h.getlist("a"), [b"b", b"c"])
assert h.getlist("a") is not ["b", "c"]
def test_encode_utf8(self):
h = Headers({'key': '\xa3'}, encoding='utf-8')
key, val = dict(h).popitem()