Consider the following minimal API:
app.MapPost("/todos", (Todo todo) =>
{
// Do something with todo here...
});
class Todo
{
public string? Text { get; set; }
}
Sending a request with invalid JSON body but that is otherwise well-formed results in a 500 response, due to the underlying JSON reader exception not being handled by the framework:

We should likely be returning a 422 Unprocessable Entity instead.
Consider the following minimal API:
Sending a request with invalid JSON body but that is otherwise well-formed results in a 500 response, due to the underlying JSON reader exception not being handled by the framework:
We should likely be returning a 422 Unprocessable Entity instead.