Test chunked transfer encoding.
(self)
| 114 | assert b"".join(body_chunks) == b"name=testuser" |
| 115 | |
| 116 | def test_chunked_body(self): |
| 117 | """Test chunked transfer encoding.""" |
| 118 | body_chunks = [] |
| 119 | |
| 120 | parser = PythonProtocol( |
| 121 | on_body=lambda chunk: body_chunks.append(chunk), |
| 122 | ) |
| 123 | |
| 124 | data = ( |
| 125 | b"POST / HTTP/1.1\r\n" |
| 126 | b"Host: example.com\r\n" |
| 127 | b"Transfer-Encoding: chunked\r\n" |
| 128 | b"\r\n" |
| 129 | b"5\r\nhello\r\n" |
| 130 | b"6\r\n world\r\n" |
| 131 | b"0\r\n\r\n" |
| 132 | ) |
| 133 | parser.feed(data) |
| 134 | |
| 135 | assert parser.is_chunked is True |
| 136 | assert parser.is_complete is True |
| 137 | assert b"".join(body_chunks) == b"hello world" |
| 138 | |
| 139 | def test_chunked_with_extension(self): |
| 140 | """Test chunked with chunk extension.""" |
nothing calls this directly
no test coverage detected