wx.request post 后台接受数据一致为null
小程序:
wx.request({
url: ‘http://localhost:63026/api/News/Uploaddata’,
method: ‘post’,
data: “123”,
header: {
“Content-Type”: “application/x-www-form-urlencoded”
},
success: function (res) {
console.log(res)
}
})
后台:
[HttpPost]
public string Uploaddata([FromBody]object value)
{
string name = HttpContext.Current.Request[“data”];
return “success2”;
}