CreateRequestFromUrl Bug

I think this is a bug. When calling HostContext.Metadata.CreateRequestFromUrl it seems to be pretty lenient with its resolution of the path and verb. I have a service defined with only IGet but it resolves all the verbs. Here is an example:

[Route("/blah")]
public class BlahRequest: IReturn<BlahResponse>, IGet
{
    public int Id { get; set; }
    public string Blahblah { get; set; }
}

public class MyServices : Service
{
    public object Any(TestDto req) => true;

    public object Get(BlahRequest req) => new BlahResponse() { Message = "message" };
}

// I assume the following should not be found since the verb is DELETE but I only have IGet/Get defined:
var requestDto = HostContext.Metadata.CreateRequestFromUrl("blah", "DELETE");

Limiting the applicability of routes should be specified on the route’s definition:

[Route("/blah", "GET")]

Why are you using this API instead of the typed Service Clients or Gateways?

1 Like

I am doing an experiment with an azure function with a wildcard route and wanted to call the service stack service based on the route info. Everything seems to work really well.

1 Like