(self)
| 2247 | return message, f |
| 2248 | |
| 2249 | def test_list_body(self): |
| 2250 | # Note that no content-length is automatically calculated for |
| 2251 | # an iterable. The request will fall back to send chunked |
| 2252 | # transfer encoding. |
| 2253 | cases = ( |
| 2254 | ([b'foo', b'bar'], b'3\r\nfoo\r\n3\r\nbar\r\n0\r\n\r\n'), |
| 2255 | ((b'foo', b'bar'), b'3\r\nfoo\r\n3\r\nbar\r\n0\r\n\r\n'), |
| 2256 | ) |
| 2257 | for body, expected in cases: |
| 2258 | with self.subTest(body): |
| 2259 | self.conn = client.HTTPConnection('example.com') |
| 2260 | self.conn.sock = self.sock = FakeSocket('') |
| 2261 | |
| 2262 | self.conn.request('PUT', '/url', body) |
| 2263 | msg, f = self.get_headers_and_fp() |
| 2264 | self.assertNotIn('Content-Type', msg) |
| 2265 | self.assertNotIn('Content-Length', msg) |
| 2266 | self.assertEqual(msg.get('Transfer-Encoding'), 'chunked') |
| 2267 | self.assertEqual(expected, f.read()) |
| 2268 | |
| 2269 | def test_manual_content_length(self): |
| 2270 | # Set an incorrect content-length so that we can verify that |
nothing calls this directly
no test coverage detected