Exemple #1
0
 @Test
 public void addParsing() {
   Headers headers =
       new Headers.Builder()
           .add("foo: bar")
           .add(" foo: baz") // Name leading whitespace is trimmed.
           .add("foo : bak") // Name trailing whitespace is trimmed.
           .add("ping:  pong  ") // Value whitespace is trimmed.
           .add("kit:kat") // Space after colon is not required.
           .build();
   assertEquals(Arrays.asList("bar", "baz", "bak"), headers.values("foo"));
   assertEquals(Arrays.asList("pong"), headers.values("ping"));
   assertEquals(Arrays.asList("kat"), headers.values("kit"));
 }
Exemple #2
0
 /**
  * Returns the values for the specified header name.
  *
  * @param name the header name.
  * @return the list of values.
  */
 public List<String> headers(String name) {
   return headers.values(name);
 }