mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
修复图片上传保存后图片破损问题
This commit is contained in:
BIN
sop-test/src/main/resources/img.png
Normal file
BIN
sop-test/src/main/resources/img.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
@@ -239,6 +239,29 @@ public class AllInOneTest extends TestBase {
|
||||
client.execute(requestBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
* 演示文件上传
|
||||
*/
|
||||
public void testFile3() {
|
||||
Client client = new Client(url, appId, privateKey);
|
||||
String root = System.getProperty("user.dir");
|
||||
Client.RequestBuilder requestBuilder = new Client.RequestBuilder()
|
||||
.method("demo.file.upload3")
|
||||
.version("1.0")
|
||||
.bizContent(new BizContent().add("remark", "test file upload"))
|
||||
// 添加文件
|
||||
.addFile("image", new File(root + "/src/main/resources/img.png"))
|
||||
.callback((requestInfo, responseData) -> {
|
||||
System.out.println(responseData);
|
||||
JSONObject jsonObject = JSON.parseObject(responseData);
|
||||
JSONObject data = jsonObject.getJSONObject(requestInfo.getDataNode());
|
||||
Assert.assertEquals(data.getString("code"), "10000");
|
||||
})
|
||||
;
|
||||
|
||||
client.execute(requestBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载文件
|
||||
*/
|
||||
|
Reference in New Issue
Block a user