(self, headers, output_files_path)
| 41 | class StreamingFormReader: |
| 42 | |
| 43 | def __init__(self, headers, output_files_path) -> None: |
| 44 | (content_type, content_type_dict) = parse_header(headers.get('Content-Type')) |
| 45 | |
| 46 | content_length = headers.get('Content-Length') |
| 47 | self.max_length = int(content_length) if content_length else 0 |
| 48 | |
| 49 | if content_type != 'multipart/form-data': |
| 50 | raise Exception('Unsupported content type: ' + content_type) |
| 51 | |
| 52 | if 'boundary' not in content_type_dict: |
| 53 | raise Exception('Failed to find boundary in header ' + content_type) |
| 54 | |
| 55 | self._boundary = b'--' + content_type_dict['boundary'].encode('utf-8') |
| 56 | self._fields_separator = b'\r\n' + self._boundary |
| 57 | self._buffer = b'' |
| 58 | self._current_part = None |
| 59 | self._output_files_path = output_files_path |
| 60 | self._read_bytes = 0 |
| 61 | self.values = {} |
| 62 | self.files = {} |
| 63 | |
| 64 | def read(self, chunk): |
| 65 | if self._reached_end(): |
nothing calls this directly
no test coverage detected