mirror of https://github.com/scrapy/scrapy.git
add tests for multiple headers with same name
This commit is contained in:
parent
e2769cfe48
commit
ddfd192b70
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in New Issue