Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

@Notallthatevil

Description

@Notallthatevil

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions