use of com.yahoo.jdisc.HeaderFields in project vespa by vespa-engine.
the class AccessControlRequestFilterTest method any_options_request_yields_access_control_headers_in_response.
@Test
public void any_options_request_yields_access_control_headers_in_response() {
HeaderFields headers = doFilterRequest(newRequestFilter(), "http://any.origin");
ACCESS_CONTROL_HEADERS.keySet().forEach(header -> assertFalse("Empty header: " + header, headers.getFirst(header).isEmpty()));
}
use of com.yahoo.jdisc.HeaderFields in project vespa by vespa-engine.
the class DiscFilterRequestTest method testGetUntreatedHeaders.
@Test
public void testGetUntreatedHeaders() {
URI uri = URI.create("http://example.yahoo.com/test");
HttpRequest httpReq = newRequest(uri, HttpRequest.Method.GET, HttpRequest.Version.HTTP_1_1);
httpReq.headers().add("key1", "value1");
httpReq.headers().add("key2", Arrays.asList("value1", "value2"));
DiscFilterRequest request = new JdiscFilterRequest(httpReq);
HeaderFields headers = request.getUntreatedHeaders();
Assert.assertEquals(headers.keySet().size(), 2);
Assert.assertEquals(headers.get("key1").get(0), "value1");
Assert.assertEquals(headers.get("key2").get(0), "value1");
Assert.assertEquals(headers.get("key2").get(1), "value2");
}
Aggregations