1、调用的方法
1 /// <summary> 2 /// 获取干预集合 3 /// </summary> 4 /// <returns></returns> 5 [HttpGet] 6 public JsonResult GetIntervenes(string keyword) 7 { 8 9 List<OPNodeItem> result = null; 10 11 return new JsonResult(result); 12 }
2、参数keyword不输入任何值,执行调用
3、报错信息
1 { 2 "errors": { 3 "keyword": [ 4 "The keyword field is required." 5 ] 6 }, 7 "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1", 8 "title": "One or more validation errors occurred.", 9 "status": 400, 10 "traceId": "00-7ed4f9a50605c93c6fec504f1589cd83-31440a115974b86a-00" 11 }
4、解决方案
Program.cs文件中添加代码
1 builder.Services.AddControllers(options => options.SuppressImplicitRequiredAttributeForNonNullableReferenceTypes = true);
参考地址:https://blog.csdn.net/lindexi_gd/article/details/109294064
标签:00,errors,keyword,GET,报错,result,NET6 From: https://www.cnblogs.com/ITjyLh/p/17354848.html