Don't convert to stream for no reason

This commit is contained in:
Sky O 2024-03-28 19:58:46 +00:00
parent 8eaa8788b9
commit b7918c2cc5

View File

@ -1,4 +1,3 @@
import io
from typing import Dict, Optional, Tuple
import multipart
@ -7,9 +6,8 @@ import multipart
def get_body_from_form_data(
body: bytes, boundary: str
) -> Tuple[Optional[bytes], Dict[str, str]]:
body_stream = io.BytesIO(body)
parser = multipart.MultipartParser(boundary=boundary)
parser.write(body_stream)
parser.write(body)
data = None
headers: Dict[str, str] = {}
for prt in parser.parts():