feign icon indicating copy to clipboard operation
feign copied to clipboard

Query param with comma produce multiple query params

Open jrobins04 opened this issue 4 years ago • 3 comments

Hi,

Client:

import java.net.URI;
import java.util.Map;

import feign.HeaderMap;
import feign.RequestLine;
import feign.Response;

public interface GenericFeignApi {
  @RequestLine("GET")
  Response get(URI uri, @HeaderMap Map<String, Object> headers);
}

Open feign 11.1 produces ?param=first&param=second&param=third

expected: ?param=first,second,third

#924 #922 - These issues are similar and got fixed by https://github.com/OpenFeign/feign/pull/930 but I am still experiencing it in OpenFeign 11.1

P.S. Currently I am able to get it work by url-encoding 'comma' in the query param before providing it to Feign as proposed in #924 #922

Thanks.

jrobins04 avatar Jun 30 '21 22:06 jrobins04

As far as I guess there should be QueryMap instead of HeaderMap. Is it correct?

vitalijr2 avatar Jul 06 '21 16:07 vitalijr2

@radio-rogal Am using an HeaderMap to pass the headers. scheme://host:port/path?query are all part of the java.net.URI uri

jrobins04 avatar Jul 06 '21 16:07 jrobins04

This is intentional. If you want different collection format, you'll need to specify that you want comma delimited. See CollectionFormat and update the RequestLine annotation and use CSV. That should produce what you are looking for.

kdavisk6 avatar Jul 19 '21 13:07 kdavisk6