Send file with HTTP.post

HTTP.jl’s API is different from Python’s requests. In particular, HTTP.request (post is a convenience method for request), doesn’t know the keyword arguments files and headers.

Instead it is called as HTTP.post(url, headers, body).

I believe something like

body = HTTP.Form(Dict(:file => fileOpened))

would do the trick. See API Reference · HTTP.jl

Your headers seem fine, but maybe you need to declare

Content-Type => multipart/form-data

No guarantees though, I’m not an expert.

1 Like