我编写了一个REST API,使用multipart reuqest上传文件。
@RequestMapping(value = Constants.REQMAP_CON_FILE_UPLOAD, method = RequestMethod.POST, headers=("content-type=multipart/form-data"), consumes = "multipart/form-data" } )
public @ResponseBody
HealthVaultResponse uploadFile(
@PathVariable Long consumerFolderId,
@PathVariable Long consumerUserId,
@PathVariable Long reportTitleId,
@RequestParam("file") MultipartFile file ,HttpServletRequest request) throws Exception {
------
------
}
它适用于Android应用程序,但网络端到达错误:
Client error: `POST http://172.16.2.67:8080/api/v1/uploadFile/1/0/5/` resulted in a `400 Bad Request` response:
{"status":{"statusCode":-400,"message":"Invalid Request, Media Type Not Supported","localizedMessage":"Invalid Request, (...)
可能是什么问题?