

在地址栏里输入请求url:http://127.0.0.1:8081/getmoney
选择“POST”方式,
在“headers”添加key:Content-Type , value:application/json
点击"body",''raw''并设定为JSON
添加:
{"userid": 1}
点击send发送即可
必须设置Header和将''raw''设定为JSON,否则报下列错误
{
"timestamp": 1543753555357,
"status": 415,
"error": "Unsupported Media Type",
"exception": "org.springframework.web.HttpMediaTypeNotSupportedException",
"message": "Content type 'text/plain;charset=UTF-8' not supported",
"path": "/api/login/account"
}
本文介绍如何通过正确设置Header和Body来发送POST请求,避免遇到UnsupportedMediaType错误。详细步骤包括设置Content-Type为application/json,以及在body中以JSON格式传递参数。
1244

被折叠的 条评论
为什么被折叠?



