@@ -68,7 +68,7 @@ def finalize(self) -> None: ...
6868 def close (self ) -> None : ...
6969
7070 class FieldProtocol (_FormProtocol , Protocol ):
71- def __init__ (self , name : bytes , content_type : str | None = None ) -> None : ...
71+ def __init__ (self , name : bytes ) -> None : ...
7272
7373 def set_none (self ) -> None : ...
7474
@@ -226,10 +226,9 @@ class Field:
226226 content_type: The value of the Content-Type header for this field.
227227 """
228228
229- def __init__ (self , name : bytes , content_type : str | None = None ) -> None :
229+ def __init__ (self , name : bytes ) -> None :
230230 self ._name = name
231231 self ._value : list [bytes ] = []
232- self ._content_type = content_type
233232
234233 # We cache the joined version of _value for speed.
235234 self ._cache = _missing
@@ -321,11 +320,6 @@ def value(self) -> bytes | None:
321320 assert isinstance (self ._cache , bytes ) or self ._cache is None
322321 return self ._cache
323322
324- @property
325- def content_type (self ) -> str | None :
326- """This property returns the content_type value of the field."""
327- return self ._content_type
328-
329323 def __eq__ (self , other : object ) -> bool :
330324 if isinstance (other , Field ):
331325 return self .field_name == other .field_name and self .value == other .value
@@ -1601,7 +1595,7 @@ def on_field_name(data: bytes, start: int, end: int) -> None:
16011595 def on_field_data (data : bytes , start : int , end : int ) -> None :
16021596 nonlocal f
16031597 if f is None :
1604- f = FieldClass (b"" .join (name_buffer ), content_type = None )
1598+ f = FieldClass (b"" .join (name_buffer ))
16051599 del name_buffer [:]
16061600 f .write (data [start :end ])
16071601
@@ -1611,7 +1605,7 @@ def on_field_end() -> None:
16111605 if f is None :
16121606 # If we get here, it's because there was no field data.
16131607 # We create a field, set it to None, and then continue.
1614- f = FieldClass (b"" .join (name_buffer ), content_type = None )
1608+ f = FieldClass (b"" .join (name_buffer ))
16151609 del name_buffer [:]
16161610 f .set_none ()
16171611
@@ -1700,7 +1694,7 @@ def on_headers_finished() -> None:
17001694 content_type_b = headers .get ("content-type" )
17011695 content_type = content_type_b .decode ("latin-1" ) if content_type_b is not None else None
17021696 if file_name is None :
1703- f_multi = FieldClass (field_name , content_type = content_type )
1697+ f_multi = FieldClass (field_name )
17041698 else :
17051699 f_multi = FileClass (
17061700 file_name , field_name , config = cast ("FileConfig" , self .config ), content_type = content_type
0 commit comments