【发布时间】:2017-01-28 11:42:07
【问题描述】:
我有一个 post api 调用,它允许我在名为“file”的表单数据参数中上传多个图像 在邮递员中,我可以将具有键“文件”和值作为多个文件的表单数据发送多个文件
我想用放心的 java 客户端模拟相同的调用。我可以放心上传单个文件但无法上传多个文件。
以下是单文件上传的放心代码:
File sheetFile = new File(sheetPath.get(0)); response = RestAssured. given(). headers(headers). formParameter("studentDetail", "{"+ "\"userId\" : "+PropFileHandler.readProperty("psUserId")+ ",\"institutionId\" : "+PropFileHandler.readProperty("institution_id")+ ",\"externalUserId\" : "+PropFileHandler.readProperty("user_id")+ ",\"tokenId\" : \"12000\""+ ",\"imagePathStatus\" : \"\""+ "}"). formParameter("clientType", getData("ps_bulk_upload_image.clientType")). multiPart("file", sheetFile). #here i want to upload multile files when(). post(relativePath). then(). statusCode(200). body(matchesJsonSchema(new File(test.cngActions.getJsonSchemaDirectoryPath()+ getData("ps_bulk_upload_image.schemaPath")))). extract().response();
任何帮助将不胜感激。
【问题讨论】:
标签: java postman rest-assured