I have the following poco
[Route("/api/whatever", "PUT")]
public class Check : IUrlFilter
{
[IgnoreDataMember]
public string Token { get; set; }
public string ToUrl(string absoluteUrl)
{
return Token.IsNullOrEmpty() ? absoluteUrl : absoluteUrl.AddQueryParam("token", Token);
}
}
Is it expected behaviour that new Check().ToUrl()
throws the following exception but new Check().ToPutUrl()
works correctly?
None of the given rest routes matches ‘Check’ request:
/api/whatever: Allowed HTTP methods ‘PUT’ does not support the specified ‘GET’ method.
[EDIT] I just saw the default verb on ToUrl() is set to “GET” so I guess that is the reason for the error, is there a way to generate the route by relying on the RouteAttribute rather than the passing the verb?