Uploading Multi-part files in julia

I tried to improve the docs for HTTP.Form and HTTP.Multipart here: HTTP.jl#676

I believe (part of) the problem is that your Content-Type header does not include the multipart boundary. Fortunately HTTP.jl should add that automatically if your body is HTTP.Form.

This should probably work, but I have not tested with the Slack API:

headers = ["Authorization" => "Bearer *****"]
data = ["channel" => "*****", "file" => open("tmp/plot2.jpg", "r")]
body = HTTP.Form(data)
HTTP.post(url, headers, body)
2 Likes