I'm converting from hato to clj-http (don't ask), and multipart is not working for me no matter what I do
In hato, it's just :multipart [{:name "request_body" :content-type "form-data" :content (json/encode body)}]
in clj-http im trying: :multipart [{:name "request_body" :content (json/encode body) :encoding "UTF-8" :mime-type "form-data"}]
This works for me:
(http/post url
{:client client
:headers {"Accept" "application/json"
...}
:multipart [{:name "file" :content content
:file-name filename}]})maybe i don't understand multipart -- what is the filename here?
I just set it to the filename of the file I am sending in the content. It is just the filename not the path.
What is the error you are getting?
that the server has an error reteiving a part of the multipart message
so not very specific
but hato Just Works, and im struggling to get clj-http to work
I may have answered incorrectly as I was using clj-http - and moved to use babashka.http-client as I am using bb. Sorry, I may not be the best to answer this.
no problem, thanks
It looks like hato includes:
content-type: multipart/form-data; boundary=hatoBoundarynSKqshIB6Wf6VnFhxnWPdnY6rkS2nH in the headers whereas clj-http does not
i guess that brings up the question: how do i set the boundary if im manually handling content type?