MCPcopy Index your code
hub / github.com/python/cpython / test_max_response_headers

Method test_max_response_headers

Lib/test/test_httplib.py:389–405  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

387 self.assertEqual(lines[3], "header: Second: val2")
388
389 def test_max_response_headers(self):
390 max_headers = client._MAXHEADERS + 20
391 headers = [f"Name{i}: Value{i}".encode() for i in range(max_headers)]
392 body = b"HTTP/1.1 200 OK\r\n" + b"\r\n".join(headers)
393
394 with self.subTest(max_headers=None):
395 sock = FakeSocket(body)
396 resp = client.HTTPResponse(sock)
397 with self.assertRaisesRegex(
398 client.HTTPException, f"got more than 100 headers"
399 ):
400 resp.begin()
401
402 with self.subTest(max_headers=max_headers):
403 sock = FakeSocket(body)
404 resp = client.HTTPResponse(sock)
405 resp.begin(_max_headers=max_headers)
406
407 def test_max_connection_headers(self):
408 max_headers = client._MAXHEADERS + 20

Callers

nothing calls this directly

Calls 6

beginMethod · 0.95
assertRaisesRegexMethod · 0.80
FakeSocketClass · 0.70
encodeMethod · 0.45
joinMethod · 0.45
subTestMethod · 0.45

Tested by

no test coverage detected