(self)
| 1812 | assert orig_ex.length == fp.BAD_LENGTH_LINE.encode() |
| 1813 | |
| 1814 | def test_truncated_before_chunk(self) -> None: |
| 1815 | stream = [b"foooo", b"bbbbaaaaar"] |
| 1816 | fp = MockChunkedNoChunks(stream) |
| 1817 | r = httplib.HTTPResponse(MockSock) # type: ignore[arg-type] |
| 1818 | r.fp = fp # type: ignore[assignment] |
| 1819 | r.chunked = True |
| 1820 | r.chunk_left = None |
| 1821 | resp = HTTPResponse( |
| 1822 | r, preload_content=False, headers={"transfer-encoding": "chunked"} |
| 1823 | ) |
| 1824 | with pytest.raises(ProtocolError) as ctx: |
| 1825 | next(resp.read_chunked()) |
| 1826 | |
| 1827 | assert str(ctx.value) == "Response ended prematurely" |
| 1828 | |
| 1829 | def test_chunked_response_without_crlf_on_end(self) -> None: |
| 1830 | stream = [b"foo", b"bar", b"baz"] |
nothing calls this directly
no test coverage detected