use of org.springframework.http.HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN in project spring-framework by spring-projects.
the class CorsWebFilterTests method invalidActualRequest.
@Test
public void invalidActualRequest() throws ServletException, IOException {
MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.delete("https://domain1.com/test.html").header(HOST, "domain1.com").header(ORIGIN, "https://domain2.com").header("header2", "foo"));
WebFilterChain filterChain = filterExchange -> Mono.error(new AssertionError("Invalid requests must not be forwarded to the filter chain"));
filter.filter(exchange, filterChain).block();
assertThat(exchange.getResponse().getHeaders().getFirst(ACCESS_CONTROL_ALLOW_ORIGIN)).isNull();
}
Aggregations