mccalltd / AttributeRouting

Define your routes using attributes on actions in ASP.NET MVC and Web API.
http://mccalltd.github.io/AttributeRouting/
MIT License
416 stars 89 forks source link

Optional query string constraints seem to be required now. #219

Closed Bitsonthefloor closed 11 years ago

Bitsonthefloor commented 11 years ago

It seems that all the changes I have had you make has caused a bug in the route resolving. routes with optional query parameters now do not match unless the parameter is supplied in the url. ex:

[GET("/admin/news/article/new?{categoryId:int?}")] /admin/news/article/new does not route but /admin/news/article/new?categoryId=0 does.

If I manually remove the constraint form the QueryStringConstraints, it will route correctly. Also the constraint does show up as an optionalconstraint wrapping a querystringconstraint.

mccalltd commented 11 years ago

Should be fixed in 3.5.6. Better damn well be fixed! ;)

ddenev commented 11 years ago

It seems this issue is still not fixed. I have v3.5.6 and the problem is still there:

[RoutePrefix("organizations")]
public class OrganizationsController : BaseApiController
    ...
    [GET("?{page:int?}")]
    public IEnumerable<Organization> GetAllOrganizations(int page) {...}

Accessing http://.../api/organizations returns: "No HTTP resource was found that matches the request URI 'http://.../api/organizations'."

Accessing http://.../api/organizations?page=1 works OK.

Note: I have an 'api' area attribute on BaseApiController

mccalltd commented 11 years ago

Querystring params are not supported in Web API due to a bug in Web API. Will be supported once Web API vNext is released.

On Mar 24, 2013, at 4:21 AM, drank notifications@github.com wrote:

It seems this issue is still not fixed. I have v3.5.6 and the problem is still there:

[RoutePrefix("organizations")]public class OrganizationsController : BaseApiController ... [GET("?{page:int?}")] public IEnumerable GetAllOrganizations(int page) {...}

Accessing http://.../api/organizations returns: "No HTTP resource was found that matches the request URI ' http://.../api/organizations'."

Accessing http://.../api/organizations?page=1 works OK.

Note: I have an 'api' area attribute on BaseApiController

— Reply to this email directly or view it on GitHubhttps://github.com/mccalltd/AttributeRouting/issues/219#issuecomment-15354209 .