上下文:
Axios电话:
// At this point I do have values on my request
// { "param1": 2021, "param2": "where the sidewalk ends" }
console.log(myRequest);
axios.post('api/myPath/create', myRequest, options)
.then(function (result) {
...
})
.catch(function (error) {
...
});
Api控制器:
namespace myNamespaceApi
{
[Route("api/myPath/create")]
[ApiController]
public class MyCreateController : .....
{
[HttpPost]
[Authorize(Policy = ShouldBeCertainRole)]
public async Task<MyApiOperationResult<MyCreateResponseViewModel>> Post([FromBody] MyCreateRequestViewModel request)
{
try
{
.....
// at this point my request comes with null values
// { "param1": null, "param2": null }
}
catch (Exception ex)
{
....
}
}
}
}
它正在进行调用,但未使用值到达方法。
有什么建议吗?