IRequest.GetRoute() returns a null route when using Typescript client

Good morning,

We are experiencing dichotomous behavior when making the same request from two different ServiceStack API clients.

Allow me to explain…

We have the following request:

[Route("/organizations/{OrganizationId}/branches/{BranchId}/users", "GET")]
public class GetUsersRequest : IReturn<GetUsersResponse>
{
    public Guid? OrganizationId { get; set; }
    public Guid? BranchId { get; set; }
}

After we submit this request using a C# ServiceStack API client, the service responsible for processing said request executes the following:

IRequest.GetRoute() 

This results in a valid RestPath which is then used to retrieve the variables associated with the Route. Works a peach.

When we make this exact same request using the Typescript ServiceStack API client, the service once again executes the following:

IRequest.GetRoute() 

This time the result is NULL.

To be clear, in both scenarios the request is successfully received and processed as expected (all request DTO properties are populated).

After taking a deeper dive we noticed the following:

The C# API client sends the data as route variables described below:

http://localhost:2000/organizations/b7080a6d-74a2-4f8a-a7e3-6223cd97f2ee/branches/7b6cf14d-ed6f-430c-9b63-9c5d17dbfd1b/users

Conversely, the Typescript API client sends the data as query parameters described below:

http://localhost:2000/json/reply/GetUsersRequest?organizationId=7597c80f-93c8-4bc6-8c8d-6642a782d209&branchId=81fb8903-8818-40a8-b482-d0e57bdfd7ac

I am certain I am missing something. Nevertheless, I would like to enforce the former behavior which provides the additional check for required route variables (The behavior seen when using the C# API client and NOT providing all the required route variables within the request DTO. Similar to the following: URL Variable Substitution).

As always, any help you could provide would be greatly appreciated.

Happy New Year

Bruce

The IRequest.GetRoute() returns a custom route, there is no custom route when a Service is executed the pre-defined routes which all non .NET Service Clients use.

If you want to use a custom route in TypeScript Client you would need to specify the Custom Route you wish to call, e.g:

var response = client.get<GetTechnologyResponse>("/technology/ServiceStack");

Understood.

Thanks again for the timely response.

Bruce