(self)
| 2025 | return length.encode() + chunk + b"\r\n" |
| 2026 | |
| 2027 | def _pop_new_chunk(self) -> bytes: |
| 2028 | if self.chunks_exhausted: |
| 2029 | return b"" |
| 2030 | try: |
| 2031 | chunk = self.content[self.index] |
| 2032 | except IndexError: |
| 2033 | chunk = b"" |
| 2034 | self.chunks_exhausted = True |
| 2035 | else: |
| 2036 | self.index += 1 |
| 2037 | chunk = self._encode_chunk(chunk) |
| 2038 | if not isinstance(chunk, bytes): |
| 2039 | chunk = chunk.encode() |
| 2040 | assert isinstance(chunk, bytes) |
| 2041 | return chunk |
| 2042 | |
| 2043 | def pop_current_chunk(self, amt: int = -1, till_crlf: bool = False) -> bytes: |
| 2044 | if amt > 0 and till_crlf: |
no test coverage detected