Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Edited Issue: Default ordering should place most specific routes before routes with variables [1246]

$
0
0
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.

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>