There might be another way to solve my problem, so if there is please advise. Currently I have a Blazor application with a WASM frontend and a server hosting with my API endpoints on the backend. Seeing as these are in the same VS solution, I have created a Endpoints class to maintain all of my base routes.
For example:
public static class Endpoints
{
public const string Route1 = "/api/v1/MyRoute";
public const string Route2 = "/api/v1/MyOtherRoute";
}
These base endpoints are then used as the base to defining my routes within Refit and the endpoints on the server. However, I would like to use Api Versioning which as far as I can tell, the route needs to have v1 replaced with v{version:apiVersion}. While this works for the serve routes, Refit complains about not having a matching parameter in its argument list.
If my approach is incorrect let me know. If this approach is valid, then it would be nice to be able to specify a setting in Refit that prevents the runtime from throwing when a parameter does not match in the argument list. This way I can replace the unused parameter myself inside a delegating handler.
Alternatively, it would also work if I could specify a parameter in the route, and have it replaced by an attribute, as opposed to an argument.
I think the easiest solution would be to add a setting to the RefitSettings, that prevents an exception from being thrown when not all parameters are matched.
There might be another way to solve my problem, so if there is please advise. Currently I have a Blazor application with a WASM frontend and a server hosting with my API endpoints on the backend. Seeing as these are in the same VS solution, I have created a Endpoints class to maintain all of my base routes.
For example:
These base endpoints are then used as the base to defining my routes within Refit and the endpoints on the server. However, I would like to use Api Versioning which as far as I can tell, the route needs to have
v1replaced withv{version:apiVersion}. While this works for the serve routes, Refit complains about not having a matching parameter in its argument list.If my approach is incorrect let me know. If this approach is valid, then it would be nice to be able to specify a setting in Refit that prevents the runtime from throwing when a parameter does not match in the argument list. This way I can replace the unused parameter myself inside a delegating handler.
Alternatively, it would also work if I could specify a parameter in the route, and have it replaced by an attribute, as opposed to an argument.
I think the easiest solution would be to add a setting to the RefitSettings, that prevents an exception from being thrown when not all parameters are matched.