T3.HTTP.Multipart (T3 v0.3.0)

Copy Markdown View Source

Multipart request bodies backed by the multipart package, including streamed files.

multipart = T3.HTTP.multipart(%{"shareId" => share_id, "text" => "Look at this"}, [
  {"file", "/absolute/path/image.png"},
  {"file", "notes.txt", "in-memory bytes", "text/plain"}
])
T3.HTTP.Guest.messages(http, query: %{"share" => share_id}, multipart: multipart)

Files are tuples of {field_name, local_path} or {field_name, filename, binary_content, content_type}. Building a local-file part stats the file; sending streams it through Finch without buffering the complete file. Fields are an enumerable of string field-name/value pairs.

Summary

Functions

build(fields, files \\ [])