When I make a request like “/api/countries/dosomething”, I am receiving the following error:
{"Message":"The request is invalid.","MessageDetail":"The parameters dictionary contains a null entry for parameter 'id'
of non-nullable type 'System.Int32' for method 'System.String Get(Int32)' in 'SampleOwinApp.CountriesController'. An op
tional parameter must be a reference type, a nullable type, or be declared as an optional parameter."}
Controller:
```
[RoutePrefix("api/countries")]
public class CountriesController : ApiController
{
[Route("{id}")]
public string Get(int id)
{
return "country info";
}
[HttpGet]
[Route("dosomething")]
public string DoSomething()
{
return "DoSomething";
}
}
```
__Expected__: When user does not specify an order explicitly, we should have a default ordering where the most specific routes come before any routes having variables.
Comments: This is related to 1238, but different. Part of the tension here is that: - Get(id) matches more parameters; but - DoSomething() has a higher precedence. So there's a design ambiguity about which wins. In the current implementation, we first take the matches that have the most parameters, and then filter on precedence. But flipping that order wouldn't necessary be correct either. We could probably come up with some more interesting test cases where this breaks.
{"Message":"The request is invalid.","MessageDetail":"The parameters dictionary contains a null entry for parameter 'id'
of non-nullable type 'System.Int32' for method 'System.String Get(Int32)' in 'SampleOwinApp.CountriesController'. An op
tional parameter must be a reference type, a nullable type, or be declared as an optional parameter."}
Controller:
```
[RoutePrefix("api/countries")]
public class CountriesController : ApiController
{
[Route("{id}")]
public string Get(int id)
{
return "country info";
}
[HttpGet]
[Route("dosomething")]
public string DoSomething()
{
return "DoSomething";
}
}
```
__Expected__: When user does not specify an order explicitly, we should have a default ordering where the most specific routes come before any routes having variables.
Comments: This is related to 1238, but different. Part of the tension here is that: - Get(id) matches more parameters; but - DoSomething() has a higher precedence. So there's a design ambiguity about which wins. In the current implementation, we first take the matches that have the most parameters, and then filter on precedence. But flipping that order wouldn't necessary be correct either. We could probably come up with some more interesting test cases where this breaks.