multipartkit/content_disposition

Types

A parsed Content-Disposition header value.

disposition is lowercased ("form-data", "attachment", …).

name and filename are convenience accessors decoded from RFC 5987 / RFC 8187 *-form when present (with the *-form taking precedence over the plain form), otherwise from the plain parameter value with surrounding quotes removed and backslash-escapes resolved per RFC 7230 quoted-string rules.

params contains every parameter as it appeared in the input including filename and name, in order. Duplicate parameter names are preserved left-to-right; only the first occurrence wins for the convenience name/filename fields.

pub type ContentDisposition {
  ContentDisposition(
    disposition: String,
    name: option.Option(String),
    filename: option.Option(String),
    params: List(#(String, String)),
  )
}

Constructors

  • ContentDisposition(
      disposition: String,
      name: option.Option(String),
      filename: option.Option(String),
      params: List(#(String, String)),
    )

Values

pub fn parse(
  value: String,
) -> Result(ContentDisposition, error.MultipartError)

Parse a Content-Disposition header value.

Returns Error(InvalidContentDisposition(value)) for unparseable input.

Search Document