-
Notifications
You must be signed in to change notification settings - Fork 119
Open
Description
Description
传统控制器可以类似这样写:
.ConfigureApiBehaviorOptions(o =>
{
o.InvalidModelStateResponseFactory = (context) =>
{
var error = context.ModelState.Keys
.SelectMany(k => context.ModelState[k].Errors)
.Select(e => e.ErrorMessage)
.ToArray();
return new JsonResult(ResponseOutput.NotOk("The inputs supplied to the API are invalid. " + JsonConvert.SerializeObject(error)));
};
});
在minimal api 有比较好的方式统一处理 来自url 路由 body 里面参数类型明显不符合要求的参数的方式么?
.NET version
No response
MASA Framework version
No response
Metadata
Metadata
Assignees
Labels
No labels