use of org.opengrok.web.api.v1.filter.CorsFilter in project OpenGrok by OpenGrok.
the class CorsFilterTest method testBoth.
private void testBoth(String origin, List<Object> headerValue) {
CorsFilter filter = new CorsFilter();
ContainerRequestContext request = mock(ContainerRequestContext.class);
when(request.getHeaderString(CORS_REQUEST_HEADER)).thenReturn(origin);
ContainerResponseContext response = mock(ContainerResponseContext.class);
MultivaluedMap<String, Object> headers = new MultivaluedHashMap<>();
when(response.getHeaders()).thenReturn(headers);
filter.filter(request, response);
assertEquals(headerValue, headers.get(ALLOW_CORS_HEADER));
}
Aggregations