POST request in juce

Hello, I am trying to make a POST request in my juce plugin and so I need to send a file in that request but I can’t seem to find how it is possible to do that in juce. I want to send a request like this one:
curl -X ‘POST’ ‘<api_url>’ -H ‘accept: application/json’ -H ‘Content-Type: multipart/form-data’ -F ‘cond=@test.mp3;type=audio/mpeg’ but I have difficulties trying to implement that -F flag
Can someone give some clues on how to do that in juce and if it is even possible

Did you have a look at withFileToUpload()?

Something like that (untested):

juce::File fileToUpload;
auto url = juce::URL ("<api_url>").withFileToUpload ("file", fileToUpload, "cond=@test.mp3;type=audio/mpeg");
auto result = url.readEntireTextStream (true /* usePostCommand */);

So I don’t know why but I managed to make it work without changing the code, but yes I used withfiletoupload and it works, thank you for the help!

Classic caveat with URL: withFileToUpload returns a modified copy. There is no method to modify an existing URL.
Doing this

juce::URL url ("<api_url>").withFileToUpload ("file", ...);

won’t work