Using ASP.NET Core 7 Minimal API:
[HttpPost("Create")]
public void Create([FromBody] User user)
{
}
Currently it is only able to accept application/x-www-form-urlencoded but I wish it can accept application/json as well.
Using ASP.NET Core 7 Minimal API:
[HttpPost("Create")]
public void Create([FromBody] User user)
{
}
Currently it is only able to accept application/x-www-form-urlencoded but I wish it can accept application/json as well.
Copyright © 2021 Jogjafile Inc.
Because of binding from form values is not natively supported in .NET 6 and 7.You can use custom model bindings to solve this:
Custom model binding:
When I use x-www-form-urlencoded format to sent data:
When I use Json format to sent data: