问题描述
post方法调用远端接口,postman成功,自己通过java代码使用httpclient请求失败.
服务端不能够调试,不知道自己的错误 A server error occurred. Please contact the administrator
问题出现的环境背景及自己尝试过哪些方法
首先需要将multipartfile转换为file
构造的httpclient的entity中,使用的是MultipartEntity
相关代码
// 请把代码文本粘贴到下方(请勿用图片代替代码)
使用postman请求
postman构造请求成功
使用postman请求本地项目
header中设置了content-type 为form-data , 返回值为"A server error occurred. Please contact the administrator."
controller层
@RequestMapping(value = "/image", method = {RequestMethod.POST})
@ResponseBody