(self)
| 1006 | self.assertFalse(newreq.has_header("Transfer-encoding")) |
| 1007 | |
| 1008 | def test_http_body_fileobj(self): |
| 1009 | # A file object - chunked encoding is used |
| 1010 | # unless Content Length is already set. |
| 1011 | # (Note that there are some subtle differences to a regular |
| 1012 | # file, that is why we are testing both cases.) |
| 1013 | |
| 1014 | h = urllib.request.AbstractHTTPHandler() |
| 1015 | o = h.parent = MockOpener() |
| 1016 | file_obj = io.BytesIO() |
| 1017 | |
| 1018 | req = Request("http://example.com/", file_obj, {}) |
| 1019 | newreq = h.do_request_(req) |
| 1020 | self.assertEqual(newreq.get_header('Transfer-encoding'), 'chunked') |
| 1021 | self.assertFalse(newreq.has_header('Content-length')) |
| 1022 | |
| 1023 | headers = {"Content-Length": 30} |
| 1024 | req = Request("http://example.com/", file_obj, headers) |
| 1025 | newreq = h.do_request_(req) |
| 1026 | self.assertEqual(int(newreq.get_header('Content-length')), 30) |
| 1027 | self.assertFalse(newreq.has_header("Transfer-encoding")) |
| 1028 | |
| 1029 | file_obj.close() |
| 1030 | |
| 1031 | @requires_subprocess() |
| 1032 | def test_http_body_pipe(self): |
nothing calls this directly
no test coverage detected