Route Decoding doesn't handle plus signs correctly


We have a route defined as below

[Route("/employee/{employeeNumber}/xxxx", “GET”)]

The issue is that one of our clients uses a plus symbol + in their employeeNumber. For example employeeNumber = “+123ABC”

When we try to encode the + symbol using %2B it gets converted into a space. I know we can create a new route that accepts the employeeNumber as a query string but that has a rippling effect as this API calls other internal APIs that follow the same route definitions where employeeNumber is part of the Route and not the Query string.

Is there a way to override how ServiceStack decodes routes? I would think that %2B should be correctly converted into a + symbol. If we use the + as is it also is converted into a space

Ex ===> employeeNumber = " 123ABC" ===> employeeNumber = " 123ABC"

The /path/info is automatically decoded, you shouldn’t be using any variables containing special URL chars on the path info, it should be encoded in the querystring. There’s not much you can do leaving it on the /path/info, you can check Request.RawUrl to see if it retains the original undecoded URL otherwise you can look at replacing it with a different unicode character that’s not used like ± and replace it in your Service. But the clear recommendation would be to remove it from the /path/info as it’s likely to be a continuous source of runtime issues.

If you used the typed service clients to send typed requests or Reverse Routing APIs to generate your URLs removing the [Route] would be a transparent implementation detail.