servicestack - Exception with default value on route -


i had dto following route defined

        [route("/route/{id}/{status}")]         public class justidandstatus : ireturn {             public long id { get; set; }             public long status { get; set; }         } 

then invoke service

localhost:9040/route/1/100

or

localhost:9040/route/0/100

and goes well.

but when use 1 of service clients got exception if of values 0 (default value long).

   var client = new jsonserviceclient("http://127.0.0.1:9040");     var request = new justidandstatus() {                     id = 0,                     status = 1                 };     var response = client.get(request); 

the exception

system.invalidoperationexception : none of given rest routes matches 'justidandstatus' request:     /route/{id}/{status}:   not match following variables: id    @ servicestack.serviceclient.web.urlextensions.tourl(ireturn request, string httpmethod, string formatfallbacktopredefinedroute) in urlextensions.cs: line 65    @ servicestack.common.tests.urlextensiontests.can_create_url_with_justidandstatus(int64 id, int64 status) in urlextensiontests.cs: line 91 

i tracked down issue commit on service stack repository https://github.com/servicestack/servicestack/commit/b34a5906a265da19d916ea47ee80783bd866abcb

i notice when updated servicestack 3.9.38 3.9.40 nuget.

i want know if behavior right, i'm using routes in wrong way or maybe issue , can submited issue tracker on github.

also make test using basic ones found on servicestack.commons source code

https://gist.github.com/anonymous/5216727

thanks in advance!

i agree describe should expected behaviour property referenced in route.

the commit refer intended suppress use of default parameter values on routes members relegated query string. however, appears have caused issue describe explicit routes.

i putting pull request address issue , add tests reflect expected behaviour.


Comments