我有一种方法,在 webapi 中,我使用 swagger 来调用 web api。在 api 请求中,“请求类型”参数应该只允许字母、数字和点(.)。我试过下面的代码,但它不起作用 [HttpGet] [SwaggerResponse(HttpStatusCode.OK, Type = typeof(string))] [Route(@"testMethod/{requestType:regex(^[A-Za-z0-9. ]+$)}")] public IHttpActionResult testMethod(int mid,string requestType = "", ) { //logic }
- 2 回答
- 0 关注
- 143 浏览
添加回答
举报
0/150
提交
取消