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 也是需要定義的,唉 自動化工具用久了,退化了

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章