feign icon indicating copy to clipboard operation
feign copied to clipboard

Spring Cloud Feign Client @RequestParam with List parameter creates a wrong request

Open prutheus opened this issue 1 year ago • 1 comments

@CollectionFormat(feign.CollectionFormat.CSV)
[...]
@RequestMapping(method = RequestMethod.GET, value = "/search/findByIdIn")
Resources<MyClass> get(@RequestParam("ids") List<Long> ids);

creates a request like: /search/findByIdIn?ids=1,2,3 ... however, feign.CollectionFormat does not support custom separation characters, I want to perform a request with values separated by ;, like /search/findByIdIn?ids=1;2;3.

How can I achieve this?

prutheus avatar May 08 '23 20:05 prutheus

Since you are using Spring, I'm not sure if you can take use the Level 3 expansion features we provide natively: https://github.com/OpenFeign/feign#request-parameter-expansion, but you can try it.

If that doesn't work for you, you'll need to create a custom Expander to generate the results you need. https://github.com/OpenFeign/feign#custom-expansion

kdavisk6 avatar May 24 '23 14:05 kdavisk6