C#C
C#3y ago
Gopher

MapPost: Parameters are null

This is my Post endpoint
app.MapPost("/register", (UserRepo userRepo, RegisterDto RegisterDto ) =>
{
  ...
}

When sending a Request with this Payload
{RegisterDto: {Name: "Herbert"}}

the Endpoint is hit, but the Name-Property in RegisterDto is still null
with [FromBody] and [AsParameters] i have the same issue
 public class RegisterDto
    {
        public string Name { get; set; }
    }

What does the JSON have to look like so that it works?
Was this page helpful?