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

Remove query template empty argument filtering #1043

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion core/src/main/java/feign/template/QueryTemplate.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ public static QueryTemplate create(String name,

/* remove all empty values from the array */
Collection<String> remaining = StreamSupport.stream(values.spliterator(), false)
.filter(Util::isNotBlank)
.collect(Collectors.toList());

StringBuilder template = new StringBuilder();
Expand Down
15 changes: 15 additions & 0 deletions core/src/test/java/feign/FeignTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ public class FeignTest {
@Rule
public final MockWebServer server = new MockWebServer();

@Test
public void emptyQueryArrayParameter() throws Exception {
server.enqueue(new MockResponse().setBody("foo"));

TestInterface api = new TestInterfaceBuilder().target("http://localhost:" + server.getPort());

api.emptyArrayElement(Arrays.asList("first", "", "third"));

assertThat(server.takeRequest())
.hasPath("/test?people=first&people=&people=third");
}

@Test
public void iterableQueryParams() throws Exception {
server.enqueue(new MockResponse().setBody("foo"));
Expand Down Expand Up @@ -938,6 +950,9 @@ void form(
@Param("user_name") String user,
@Param("password") String password);

@RequestLine("GET /test?people={people}")
Response emptyArrayElement(@Param(value = "people", encoded = true) Collection<String> people);

@RequestLine("GET /{1}/{2}")
Response uriParam(@Param("1") String one, URI endpoint, @Param("2") String two);

Expand Down