Use header class
This commit is contained in:
parent
7606a4fee2
commit
0cde7e3d08
@ -6,6 +6,10 @@ class Part:
|
|||||||
headers = []
|
headers = []
|
||||||
data : bytes
|
data : bytes
|
||||||
|
|
||||||
|
class Header:
|
||||||
|
name : bytes
|
||||||
|
value : bytes
|
||||||
|
|
||||||
def get_body_from_form_data(
|
def get_body_from_form_data(
|
||||||
body: bytes, boundary: str
|
body: bytes, boundary: str
|
||||||
) -> Tuple[Optional[bytes], Dict[str, str]]:
|
) -> Tuple[Optional[bytes], Dict[str, str]]:
|
||||||
@ -38,7 +42,9 @@ def get_body_from_form_data(
|
|||||||
return
|
return
|
||||||
|
|
||||||
def on_header_field(b,s,e):
|
def on_header_field(b,s,e):
|
||||||
current_part.headers.append({ name : b[s:e], value: ""})
|
h = Header()
|
||||||
|
h.name = b[s:e]
|
||||||
|
current_part.headers.append(h)
|
||||||
print("YO HEADER FIELD", )
|
print("YO HEADER FIELD", )
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user