MultipartFormData

See IETF RFC 7578 Returning Values from Forms: multipart/form-data https://datatracker.ietf.org/doc/html/rfc7578

FormData

parse_form_url_encoded : List U8 -> Result (Dict Str Str) [BadUtf8]

Parse URL-encoded form values (todo=foo&status=bar) into a Dict (("todo", "foo"), ("status", "bar")).

expect
    bytes = Str.toUtf8 "todo=foo&status=bar"
    parsed = parse_form_url_encoded bytes |> Result.withDefault (Dict.empty {})

    Dict.toList parsed == [("todo", "foo"), ("status", "bar")]

parse_multipart_form_data : { headers : List InternalHttp.Header, body : List U8 } -> Result (List MultipartFormData.FormData) [ InvalidMultipartFormData, ExpectedContentTypeHeader, InvalidContentTypeHeader ]

For HTML forms that include files or large amounts of text.

See usage in examples/file-upload-form.roc

decode_multipart_form_data_boundary : List { name : Str, value : Str } -> Result (List U8)