use of com.linkedin.r2.message.MessageHeaders in project rest.li by linkedin.
the class TestRestBuilders method testHeaderWithNullListElem.
@Test
public void testHeaderWithNullListElem() {
final String headerName = "key";
final String headerVal1 = "value1";
final String headerVal2 = "value2";
final String headerValue = headerVal1 + ", ," + headerVal2;
final MessageHeaders msg = new RestResponseBuilder().addHeaderValue(headerName, headerValue).build();
Assert.assertEquals(headerValue, msg.getHeader(headerName));
Assert.assertEquals(Arrays.asList(headerVal1, headerVal2), msg.getHeaderValues(headerName));
}
use of com.linkedin.r2.message.MessageHeaders in project rest.li by linkedin.
the class TestRestBuilders method testSetMultiValueHeader.
@Test
public void testSetMultiValueHeader() {
final String headerName = "key";
final String headerVal1 = "value1";
final String headerVal2 = "value2";
final String headerValue = headerVal1 + ',' + headerVal2;
final MessageHeaders msg = new RestResponseBuilder().setHeader(headerName, headerValue).build();
Assert.assertEquals(headerValue, msg.getHeader(headerName));
Assert.assertEquals(Arrays.asList(headerVal1, headerVal2), msg.getHeaderValues(headerName));
}
use of com.linkedin.r2.message.MessageHeaders in project rest.li by linkedin.
the class TestRestBuilders method testAddMultipleValuesToHeader.
@Test
public void testAddMultipleValuesToHeader() {
final String headerName = "key";
final String headerVal1 = "value1";
final String headerVal2 = "value2";
final String headerValue = headerVal1 + ',' + headerVal2;
final MessageHeaders msg = new RestResponseBuilder().addHeaderValue(headerName, headerVal1).addHeaderValue(headerName, headerVal2).build();
Assert.assertEquals(headerValue, msg.getHeader(headerName));
Assert.assertEquals(Arrays.asList(headerVal1, headerVal2), msg.getHeaderValues(headerName));
}
use of com.linkedin.r2.message.MessageHeaders in project rest.li by linkedin.
the class TestRestBuilders method testAddMultipleValuesToHeader2.
@Test
public void testAddMultipleValuesToHeader2() {
final String headerName = "key";
final String headerVal1a = "value1a";
final String headerVal1b = "value1b";
final String headerVal1 = headerVal1a + "," + headerVal1b;
final String headerVal2 = "value2";
final String headerValue = headerVal1 + ',' + headerVal2;
final MessageHeaders msg = new RestResponseBuilder().addHeaderValue(headerName, headerVal1).addHeaderValue(headerName, headerVal2).build();
Assert.assertEquals(headerValue, msg.getHeader(headerName));
Assert.assertEquals(Arrays.asList(headerVal1a, headerVal1b, headerVal2), msg.getHeaderValues(headerName));
}
Aggregations