multipartkit/part
Types
A parsed multipart part.
headers keeps entries in the order they appeared on the wire; header
names retain their original casing. Header values have surrounding
optional whitespace stripped per RFC 7230 §3.2.4 but are otherwise
preserved (no quote unescaping, no parameter normalisation, no inner
whitespace collapse).
Header bytes must be valid UTF-8 — header blocks that contain non-UTF-8
bytes are rejected with InvalidHeader. The body has no such
restriction: it is always treated as raw bytes; the parser does not
transcode or UTF-8-validate it.
name, filename, and content_type are convenience caches derived from
Content-Disposition and Content-Type headers per the field/file
detection rules. They are not re-derived automatically when a caller
constructs a Part manually.
pub type Part {
Part(
headers: List(#(String, String)),
name: option.Option(String),
filename: option.Option(String),
content_type: option.Option(String),
body: BitArray,
)
}
Constructors
-
Part( headers: List(#(String, String)), name: option.Option(String), filename: option.Option(String), content_type: option.Option(String), body: BitArray, )
Values
pub fn header(part: Part, name: String) -> option.Option(String)
Return the first header value whose name matches name ASCII
case-insensitively.