0
API署名をアシュアード:春。残りは
@RequestMapping(value = "uploadImage", method = RequestMethod.POST, produces = {"application/sd-service", "application/json"})
@ResponseBody
public ImageUploadResponse uploadImage(@RequestParam(value = "channel", required=false) Channel channel, @RequestParam(value = "file") MultipartFile file, @RequestParam(value = "responseProtocol")Protocol responseProtocol)
私は残りの部分を使用していた画像ファイルをアップロードするには、次のリクエストを送信するために保証しました。
Response res=RestAssured
.given()
.contentType("image/jpeg"
.body("{"responseProtocol":"PROTOCOL_JSON","channel":"WEB"}")
.multiPart(fileItem)
.when()
.log()
.all()
.post("http://x.y.z.a:8080/service/contactus/v2/uploadImage")
.andReturn();
ここで、String userDir = System.getProperty( "user.dir");
File fileItem= new File(userDir +"//src//main//resources//1.jpeg");
は画像ファイルです。しかし、エラーのため、何の結果は下記ません:フォームパラメータを使用して
Getting org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.web.multipart.MultipartException: The current request is not a multipart request for below case:
.contentType( "multipart/form-data") –