MultipartPart
struct MultipartPartA single part inside a multipart/form-data body.
Fields:
name: name="..." from Content-Disposition;
empty if absent (treated as malformed).
filename: filename="..." if present (file uploads);
empty for plain text fields.
content_type: Content-Type of this part if specified;
empty otherwise (defaults to
text/plain; charset=US-ASCII per RFC 7578
§4.4 if a consumer needs a non-empty fallback).
body: The part's raw payload bytes (no trailing CRLF).
headers: Every header line for this part as a parallel
List[String] pair.
Implements Copyable, Movable
- Fields
name: Stringfilename: Stringcontent_type: Stringbody: List[UInt8]header_keys: List[String]header_values: List[String]
__init__
def __init__(out self) text
def text(self) -> String Decode the part body as a UTF-8 String.
Invalid UTF-8 sequences are replaced with the Unicode replacement character: part bodies are raw client-supplied bytes (RFC 7578 §4.2), so this never raises on malformed input.
is_file
def is_file(self) -> Bool Return True if this part represents a file upload (has filename).
header
def header(self, key: String) -> String Return part-level header key (case-insensitive), or "".