@Test public void owsTrimming() { final CombinedHttpHeaders headers = newCombinedHttpHeaders(); headers.set(HEADER_NAME, Arrays.asList("\ta", " ", " b ", "\t \t")); headers.add(HEADER_NAME, " c, d \t"); assertEquals(Arrays.asList("a", "", "b", "", "c, d"), headers.getAll(HEADER_NAME)); assertEquals("a,,b,,\"c, d\"", headers.get(HEADER_NAME)); assertTrue(headers.containsValue(HEADER_NAME, "a", true)); assertTrue(headers.containsValue(HEADER_NAME, " a ", true)); assertTrue(headers.containsValue(HEADER_NAME, "a", true)); assertFalse(headers.containsValue(HEADER_NAME, "a,b", true)); assertFalse(headers.containsValue(HEADER_NAME, " c, d ", true)); assertFalse(headers.containsValue(HEADER_NAME, "c, d", true)); assertTrue(headers.containsValue(HEADER_NAME, " c ", true)); assertTrue(headers.containsValue(HEADER_NAME, "d", true)); assertTrue(headers.containsValue(HEADER_NAME, "\t", true)); assertTrue(headers.containsValue(HEADER_NAME, "", true)); assertFalse(headers.containsValue(HEADER_NAME, "e", true)); HttpHeaders copiedHeaders = newCombinedHttpHeaders().add(headers); assertEquals(Arrays.asList("a", "", "b", "", "c, d"), copiedHeaders.getAll(HEADER_NAME)); }
@Override public boolean containsValue(CharSequence name, CharSequence value, boolean ignoreCase) { return super.containsValue(name, StringUtil.trimOws(value), ignoreCase); }
CombinedHttpHeaders extends DefaultHttpHeaders { @Override public boolean containsValue(CharSequence name, CharSequence value, boolean ignoreCase) { return super.containsValue(name, StringUtil.trimOws(value), ignoreCase); } }
CombinedHttpHeaders extends DefaultHttpHeaders { @Override public boolean containsValue(CharSequence name, CharSequence value, boolean ignoreCase) { return super.containsValue(name, StringUtil.trimOws(value), ignoreCase); } CombinedHttpHeaders(boolean validate); }
CombinedHttpHeaders extends DefaultHttpHeaders { @Override public boolean containsValue(CharSequence name, CharSequence value, boolean ignoreCase) { return super.containsValue(name, StringUtil.trimOws(value), ignoreCase); } CombinedHttpHeaders(boolean validate); @Override boolean containsValue(CharSequence name, CharSequence value, boolean ignoreCase); }
CombinedHttpHeaders extends DefaultHttpHeaders { @Override public boolean containsValue(CharSequence name, CharSequence value, boolean ignoreCase) { return super.containsValue(name, StringUtil.trimOws(value), ignoreCase); } CombinedHttpHeaders(boolean validate); @Override boolean containsValue(CharSequence name, CharSequence value, boolean ignoreCase);  }