How can I make a multipart/form-data POST request using Java?

后端 未结 11 1689
攒了一身酷
攒了一身酷 2020-11-22 05:56

In the days of version 3.x of Apache Commons HttpClient, making a multipart/form-data POST request was possible (an example from 2004). Unfortunately this is no longer possi

11条回答
  •  没有蜡笔的小新
    2020-11-22 06:18

    You can also use REST Assured which builds on HTTP Client. It's very simple:

    given().multiPart(new File("/somedir/file.bin")).when().post("/fileUpload");
    

提交回复
热议问题