Curl post with multipart/form-data and JSON

2019-04-24 16:23发布

Is there a way to use curl to do a multipart/form-data post and specify that the data is application/json? It doesn't have to be curl.

1条回答
走好不送
2楼-- · 2019-04-24 16:56

This is what I use, and it works fine

curl -v -H "Content-Type:multipart/form-data" 
        -F "someName={\"your\":\"json\"};type=application/json"

Note: I'm on Windows, hence the requirement for double quotes

Or

-F "someName=@someJsonFile.json;type=application/json"
查看更多
登录 后发表回答