Unsupported Media Type","message":"Content type 'application/octet-stream' not supported"

今天使用新的工具ApiPost,调试我的接口,老出错:

一:错误描述:

springboot后端的异常:

[org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/octet-stream' not supported]

ApiPost工具端的异常如下:

{
	"timestamp": "2020-03-02T09:10:34.256+0000",
	"status": 415,
	"error": "Unsupported Media Type",
	"message": "Content type 'application/octet-stream' not supported",
	"path": "/message/wechatTemplate/synchWechatTemplate"
}

二:问题查找

@RequestMapping(value = "/materials",method = RequestMethod.POST )
@ResponseBody
public WebResultInfo collectMetails (@RequestBody ParamsData params)throws GlobalException {
	logger.info("code runing -->> 001 --- materials ");
	logger.info("param : {} " , params.toString() );
	
	return WebResultInfo.success() ;
}

没什么问题呀,百度了一下,都说要删除 @RequestBody ,脑子瓦特了 我是JSON传输的数据,让我删除!

三:解决问题

回想一下http请求的几种数据格式,脑子濒临崩溃时记起,Header 也是需要定义的,唉 自动化工具用久了,退化了

猜你喜欢

转载自blog.csdn.net/yexiaomodemo/article/details/104615557
今日推荐