我有一种方法,在 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
}
陪伴而非守候
森林海
相关分类