mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 12:56:28 +08:00
4.2.2
This commit is contained in:
BIN
sop-test/src/main/resources/large_img.png
Normal file
BIN
sop-test/src/main/resources/large_img.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 MiB |
@@ -224,6 +224,29 @@ public class AllInOneTest extends TestBase {
|
||||
client.execute(requestBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
* 演示大文件上传,先配置网关参数:spring.servlet.multipart.max-file-size=1MB
|
||||
*/
|
||||
public void testBigFile() {
|
||||
Client client = new Client(url, appId, privateKey);
|
||||
String root = System.getProperty("user.dir");
|
||||
Client.RequestBuilder requestBuilder = new Client.RequestBuilder()
|
||||
.method("file.upload3")
|
||||
.version("1.0")
|
||||
.bizContent(new BizContent().add("remark", "test file upload"))
|
||||
// 添加文件
|
||||
.addFile("image", new File(root + "/src/main/resources/large_img.png"))
|
||||
.callback((requestInfo, responseData) -> {
|
||||
System.out.println(responseData);
|
||||
JSONObject jsonObject = JSON.parseObject(responseData);
|
||||
JSONObject data = jsonObject.getJSONObject(requestInfo.getDataNode());
|
||||
Assert.assertEquals(data.getString("sub_code"), "isv.invalid-file-size");
|
||||
})
|
||||
;
|
||||
|
||||
client.execute(requestBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
* 传递header
|
||||
*/
|
||||
|
Reference in New Issue
Block a user