Encodes a list of form fields as a multipart/form-data body.
Returns the encoded body string and the Content-Type header
(which includes the boundary). Pass both to a request function:
local body, contentType = http.multipart({
{ name = "username", value = "alice" },
{ name = "avatar", value = fileContents, filename = "photo.png", contentType = "image/png" },
})
local resp = http.post("http://example.com/upload", body, {
headers = { ["Content-Type"] = contentType },
})