最近用postman调试接口,默认Headers里面的Content-Type为text/plain,无法修改,输入Request Body相应内容后发送请求,页面报500,如图:

后台提示:
org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'text/plain;charset=UTF-8' not supported
直接修改Content-Type无法操作,进入postman的Body页面,选定raw,格式从Text下拉改为JSON,回到Headers页面会发现Content-Type自动改为application/json

发送请求,接口调试成功。
解决Postman中Content-Type问题调试接口
在使用Postman调试接口时遇到问题,当Content-Type默认为text/plain导致HTTP500错误。后台报错不支持此类型。通过将Body设置为raw并选择JSON格式,Content-Type自动更改为application/json,从而解决了问题,接口调试成功。
669





