问题描述
可以在HttpHeader中设置“application/x-www-form-urlencoded”,但是我想设置为requestbody,请指导一下?
示例 json:
LoadBalancer
代码:
"header": [
{
"key": "Content-Type","value": "application/json","type": "text"
}
],"body": {
"mode": "urlencoded","urlencoded": [
{
"key": "username","value": "Tohid","type": "text"
},{
"key": "password","value": "*makari",{
"key": "grant_type","value": "password","type": "text"
}
]
},
解决方法
最后我发现在“application/x-www-form-urlencoded”中我们必须使用如下:
MultiValueMap<String,String> requestBody = new LinkedMultiValueMap<>();
requestBody.add("username",propertyConfig.getUserName());