summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorMarco Strigl <mstrigl@suse.com>2018-06-19 13:20:58 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2018-06-19 13:20:58 (GMT)
commit936f03e7fafc28fd6fdfba11d162c776b89c0167 (patch)
treed6b0e312d49674aed7bde34ce2674ffe343e10fc /Lib/test
parent1261bfa83db30b1cf86c1fb816cc167db77874cd (diff)
downloadcpython-936f03e7fafc28fd6fdfba11d162c776b89c0167.zip
cpython-936f03e7fafc28fd6fdfba11d162c776b89c0167.tar.gz
cpython-936f03e7fafc28fd6fdfba11d162c776b89c0167.tar.bz2
bpo-33365: print the header values beside the keys (GH-6611)
with debuglevel=1 only the header keys got printed. With this change the header values get printed as well and the single header entries get '\n' as a separator.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_httplib.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py
index a3f8194..f816eac 100644
--- a/Lib/test/test_httplib.py
+++ b/Lib/test/test_httplib.py
@@ -344,6 +344,21 @@ class HeaderTests(TestCase):
with self.assertRaisesRegex(ValueError, 'Invalid header'):
conn.putheader(name, value)
+ def test_headers_debuglevel(self):
+ body = (
+ b'HTTP/1.1 200 OK\r\n'
+ b'First: val\r\n'
+ b'Second: val\r\n'
+ )
+ sock = FakeSocket(body)
+ resp = client.HTTPResponse(sock, debuglevel=1)
+ with support.captured_stdout() as output:
+ resp.begin()
+ lines = output.getvalue().splitlines()
+ self.assertEqual(lines[0], "reply: 'HTTP/1.1 200 OK\\r\\n'")
+ self.assertEqual(lines[1], "header: First: val")
+ self.assertEqual(lines[2], "header: Second: val")
+
class TransferEncodingTest(TestCase):
expected_body = b"It's just a flesh wound"