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

Method test_request

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

Source from the content-addressed store, hash-verified

507 self.assertEqual(self._parse_chunked(body), self.expected_body)
508
509 def test_request(self):
510 for empty_lines in (False, True,):
511 conn = client.HTTPConnection('example.com')
512 conn.sock = FakeSocket(b'')
513 conn.request(
514 'POST', '/', self._make_body(empty_lines=empty_lines))
515
516 _, headers, body = self._parse_request(conn.sock.data)
517 body = self._parse_chunked(body)
518 self.assertEqual(body, self.expected_body)
519 self.assertEqual(headers['Transfer-Encoding'], 'chunked')
520
521 # Content-Length and Transfer-Encoding SHOULD not be sent in the
522 # same request
523 self.assertNotIn('content-length', [k.lower() for k in headers])
524
525 def test_empty_body(self):
526 # Zero-length iterable should be treated like any other iterable

Callers

nothing calls this directly

Calls 8

requestMethod · 0.95
_make_bodyMethod · 0.95
_parse_requestMethod · 0.95
_parse_chunkedMethod · 0.95
assertNotInMethod · 0.80
FakeSocketClass · 0.70
assertEqualMethod · 0.45
lowerMethod · 0.45

Tested by

no test coverage detected