Read exactly size bytes asynchronously.
(self, size)
| 109 | self._set_body_reader() |
| 110 | |
| 111 | async def _async_read_exact(self, size): |
| 112 | """Read exactly size bytes asynchronously.""" |
| 113 | buf = bytearray() |
| 114 | while len(buf) < size: |
| 115 | chunk = await self.unreader.read(size - len(buf)) |
| 116 | if not chunk: |
| 117 | break |
| 118 | buf.extend(chunk) |
| 119 | return bytes(buf) |
| 120 | |
| 121 | def _set_body_reader(self): |
| 122 | """Set up body state for async reading.""" |