我有一个像下面这样的休息 Api。
@POST
@Path("/importFile")
@Consumes("application/zip")
@ApiOperation(value = "Importing File")
public List<String> importFile(InputStream is) throws IOException {
ZipInputStream zipInputStream = new ZipInputStream(is);
return importFile(zipInputStream);
}
我如何测试它?
最佳答案
你可以使用 curl 工具 -
curl -v -F file=@file1.txt -F http://testYouFile/endpoint
您还可以使用 postman 或 https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo 等 chrome 附加组件
关于java - 测试接受 zip 文件作为输入的 Rest Api,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30460935/