APISonar


feign.CollectionFormat.CSV

> feign > CollectionFormat > CSV
feign APIs CollectionFormat APIs CSV APIs

Example 1
public void expandCollectionValueWithBrackets() {
    QueryTemplate template =
        QueryTemplate.create("collection[]", Collections.singletonList("{collection[]}"),
            Util.UTF_8, CollectionFormat.CSV);
    String expanded = template.expand(Collections.singletonMap("collection[]",
        Arrays.asList("1", "2")));
    /* brackets will be pct-encoded */
    assertThat(expanded).isEqualToIgnoringCase("collection%5B%5D=1,2");
  }
Example 2
public void collectionFormat() {
    QueryTemplate template =
        QueryTemplate
            .create("name", Arrays.asList("James", "Jason"), Util.UTF_8, CollectionFormat.CSV);
    String expanded = template.expand(Collections.emptyMap());
    assertThat(expanded).isEqualToIgnoringCase("name=James,Jason");
  }