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

Method test_negative_content_length

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

Source from the content-addressed store, hash-verified

1267 self.assertTrue(resp.closed)
1268
1269 def test_negative_content_length(self):
1270 sock = FakeSocket(
1271 'HTTP/1.1 200 OK\r\nContent-Length: -1\r\n\r\nHello\r\n')
1272 resp = client.HTTPResponse(sock, method="GET")
1273 resp.begin()
1274 self.assertEqual(resp.read(), b'Hello\r\n')
1275 self.assertTrue(resp.isclosed())
1276
1277 def test_incomplete_read(self):
1278 sock = FakeSocket('HTTP/1.1 200 OK\r\nContent-Length: 10\r\n\r\nHello\r\n')

Callers

nothing calls this directly

Calls 6

beginMethod · 0.95
readMethod · 0.95
isclosedMethod · 0.95
assertTrueMethod · 0.80
FakeSocketClass · 0.70
assertEqualMethod · 0.45

Tested by

no test coverage detected