multipartkit/header

Values

pub fn boundary(
  content_type: String,
) -> Result(String, error.MultipartError)

Extract the boundary parameter from a Content-Type header value.

The error priority documented for parse is enforced here:

  1. InvalidContentType(value) — value cannot be parsed as a media type.
  2. UnsupportedMediaType(media_type) — top-level media type is not multipart/*.
  3. MissingBoundary — the boundary parameter is absent.
  4. InvalidBoundary(value) — present but violates the RFC 2046 grammar.
pub fn validate_boundary(value: String) -> Bool

Returns True when value satisfies the RFC 2046 §5.1.1 boundary grammar (1-70 bchars ending in a bcharsnospace). Used by boundary/1 on the parse side and by the encoder on the encode side so both ends reject the same set of strings.

Search Document