(self)
| 2203 | return message, f |
| 2204 | |
| 2205 | def test_list_body(self): |
| 2206 | # Note that no content-length is automatically calculated for |
| 2207 | # an iterable. The request will fall back to send chunked |
| 2208 | # transfer encoding. |
| 2209 | cases = ( |
| 2210 | ([b'foo', b'bar'], b'3\r\nfoo\r\n3\r\nbar\r\n0\r\n\r\n'), |
| 2211 | ((b'foo', b'bar'), b'3\r\nfoo\r\n3\r\nbar\r\n0\r\n\r\n'), |
| 2212 | ) |
| 2213 | for body, expected in cases: |
| 2214 | with self.subTest(body): |
| 2215 | self.conn = client.HTTPConnection('example.com') |
| 2216 | self.conn.sock = self.sock = FakeSocket('') |
| 2217 | |
| 2218 | self.conn.request('PUT', '/url', body) |
| 2219 | msg, f = self.get_headers_and_fp() |
| 2220 | self.assertNotIn('Content-Type', msg) |
| 2221 | self.assertNotIn('Content-Length', msg) |
| 2222 | self.assertEqual(msg.get('Transfer-Encoding'), 'chunked') |
| 2223 | self.assertEqual(expected, f.read()) |
| 2224 | |
| 2225 | def test_manual_content_length(self): |
| 2226 | # Set an incorrect content-length so that we can verify that |
nothing calls this directly
no test coverage detected