Set content type of part of multipart/mixed request in CURL Set content type of part of multipart/mixed request in CURL curl curl

Set content type of part of multipart/mixed request in CURL


You can add content-type information after semicolon:

curl -H "Content-Type: multipart/mixed" -F "request={"param1": "value1"};type=application/json"


To attach both a payload and a file using curl command, some like this will do.

curl -i -X POST -H "Content-Type: multipart/mixed" \-F "somepayload={\"name\":\"mypayloadname\"};type=application/json" \-F "uploadfile=@somevalid.xml" http://localhost:8080/path/topost

Make sure you escape the payload content and somevalid.xml should be there in the same directory where curl is executed or replace it with valid path to the file.