8000 Add option to not throw exception when route parameter does not have a matching argument. · Issue #1968 · reactiveui/refit · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add option to not throw exception when route parameter does not have a matching argument. #1968

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Notallthatevil opened this issue Apr 8, 2025 · 0 comments

Comments

@Notallthatevil
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0