Richard Fawcett
Richard Fawcett

Reputation: 2809

ServiceStack not URL decoding route parameter in RESTful route

I'm using self hosted ServiceStack to provide an API to integrate with a ticketing system, and have defined the following routes:

Routes
    .Add<TicketsWithStatus>("tickets/{Status}")
    .Add<TicketStatusCounts>("tickets");

I'm having URL encoding problems with the first route when the status contains a space. If I browse to http://myservicebase/json/syncreply/TicketsWithStatus?Status=On%20Hold I get the response I'm expecting. However, if I use the RESTful route http://mysevicebase/tickets/On%20Hold I don't get any results.

Debugging my application, I can see that the On%20Hold is being URL decoded to On Hold in the case of the json/syncreply call, but is not decoded when using the RESTful route.

How can I ensure that the status property is properly decoded when calling my service via the RESTful route?

Upvotes: 2

Views: 740

Answers (1)

mythz
mythz

Reputation: 143284

ServiceStack doesn't UrlDecode the PathInfo, it uses the same HttpRequest.PathInfo that the ASP.NET Request object returns. You might have better success if you change it to On+Hold.

Upvotes: 1

Related Questions