[#3869] Add unit test to ensure adding null header values is not allowed.
Motivation: We need to ensure we never allow to have null values set on headers, otherwise we will see a NPE during encoding them. Modifications: Add unit test that shows we correctly handle null values. Result: Verify correct implementation.
This commit is contained in:
parent
cf54c04241
commit
e9a2cac16d
@ -57,4 +57,16 @@ public class HttpHeadersTest {
|
||||
assertThat(AsciiString.equalsIgnoreCase("bar", null), is(false));
|
||||
assertThat(AsciiString.equalsIgnoreCase("FoO", "fOo"), is(true));
|
||||
}
|
||||
|
||||
@Test(expected = NullPointerException.class)
|
||||
public void testSetNullHeaderValueValidate() {
|
||||
HttpHeaders headers = new DefaultHttpHeaders(true);
|
||||
headers.set("test", (CharSequence) null);
|
||||
}
|
||||
|
||||
@Test(expected = NullPointerException.class)
|
||||
public void testSetNullHeaderValueNotValidate() {
|
||||
HttpHeaders headers = new DefaultHttpHeaders(false);
|
||||
headers.set("test", (CharSequence) null);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user