Skip to content
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

Support duplicate query parameters #1762

Open
MarvinKlein1508 opened this issue Jul 24, 2024 · 1 comment
Open

Support duplicate query parameters #1762

MarvinKlein1508 opened this issue Jul 24, 2024 · 1 comment
Labels

Comments

@MarvinKlein1508
Copy link

Is your feature request related to a problem? Please describe.
I have a class which holds two properties. One of them is an IEnumerable<string>.

For example:

public class GetAllProductsRequest 
{
    public string? Name { get; set; }
    public IEnumerable<string>? Types { get; set; }
}

In my interface I have it like this:

[Get(ApiEndpoints.Products.GetAll)]
Task<ProductsResponse> GetProductsAsync(GetAllProductsRequest request, CancellationToken cancellationToken = default);

The refit client now tries to fetch this URL:

https://localhost:7049/api/products?Types=N%2C1

This results in my API crashing because I expect the value to be send like in swagger. Which would be:

https://localhost:7049/api/products?Types=N&Types=1

Describe the solution you'd like
I would likt be able to define this behavior using the [Query] attribute.

Describe alternatives you've considered
I'Ve tried to use [Query.Multi] but using this requires me to change the API to split the values everytime because all types will be in Types[0]

@xljiulang
Copy link
Contributor

The collection field feature is not currently supported in refit, but is supported by WebApiClient

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

No branches or pull requests

3 participants