formdata数据:
------WebKitFormBoundaryHw8awRPuYAW8ZCUB
Content-Disposition: form-data; name="files"; filename="Martin Garrix.jpg"
Content-Type: image/jpeg
------WebKitFormBoundaryHw8awRPuYAW8ZCUB
Content-Disposition: form-data; name="files"; filename="Martin Garrix.jpg"
Content-Type: image/jpeg
------WebKitFormBoundaryHw8awRPuYAW8ZCUB
Content-Disposition: form-data; name="goods"
{"goodsName":"wwqe","goodsDescribe":"wqe","categoryId":"608834794213605376","goodsStock":"123","goodsPrice":"23","goodsStatus":"1"}
------WebKitFormBoundaryHw8awRPuYAW8ZCUB--
报错:
error: "Unsupported Media Type"
message: "Content type 'application/octet-stream' not supported"
path: "/goods"
status: 415
timestamp: "2019-08-07T19:12:05.631+0000"
trace: "org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/octet-stream' not supported
↵
Controller方法:
@PostMapping(value = "")
@ResponseBody
public Result<PageModel> insert(@RequestPart("goods") Goods goods, @RequestParam("files") MultipartFile[] files) {
logger.info("添加商品");
return Result.success("sad", null);
}
我看网上都是这么写的,为什么我的报错了,有大佬能解惑吗
把@ResponseBody注解删掉估计可以