MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_request

Method test_request

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

Source from the content-addressed store, hash-verified

461 self.assertEqual(self._parse_chunked(body), self.expected_body)
462
463 def test_request(self):
464 for empty_lines in (False, True,):
465 conn = client.HTTPConnection('example.com')
466 conn.sock = FakeSocket(b'')
467 conn.request(
468 'POST', '/', self._make_body(empty_lines=empty_lines))
469
470 _, headers, body = self._parse_request(conn.sock.data)
471 body = self._parse_chunked(body)
472 self.assertEqual(body, self.expected_body)
473 self.assertEqual(headers['Transfer-Encoding'], 'chunked')
474
475 # Content-Length and Transfer-Encoding SHOULD not be sent in the
476 # same request
477 self.assertNotIn('content-length', [k.lower() for k in headers])
478
479 def test_empty_body(self):
480 # 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