use of org.springframework.web.reactive.result.method.RequestMappingInfo in project spring-framework by spring-projects.
the class RequestMappingInfoTests method matchConsumesCondition.
@Test
public void matchConsumesCondition() {
ServerWebExchange exchange = MockServerHttpRequest.post("/foo").contentType(MediaType.TEXT_PLAIN).toExchange();
RequestMappingInfo info = paths("/foo").consumes("text/plain").build();
RequestMappingInfo match = info.getMatchingCondition(exchange);
assertNotNull(match);
info = paths("/foo").consumes("application/xml").build();
match = info.getMatchingCondition(exchange);
assertNull(match);
}
use of org.springframework.web.reactive.result.method.RequestMappingInfo in project spring-framework by spring-projects.
the class RequestMappingInfoTests method preFlightRequest.
@Test
@Ignore
public void preFlightRequest() throws Exception {
MockServerWebExchange exchange = MockServerHttpRequest.options("/foo").header("Origin", "http://domain.com").header(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS, "POST").toExchange();
RequestMappingInfo info = paths("/foo").methods(RequestMethod.POST).build();
RequestMappingInfo match = info.getMatchingCondition(exchange);
assertNotNull(match);
info = paths("/foo").methods(RequestMethod.OPTIONS).build();
match = info.getMatchingCondition(exchange);
assertNull("Pre-flight should match the ACCESS_CONTROL_REQUEST_METHOD", match);
}
use of org.springframework.web.reactive.result.method.RequestMappingInfo in project spring-framework by spring-projects.
the class RequestMappingInfoTests method matchPatternsCondition.
@Test
public void matchPatternsCondition() {
MockServerWebExchange exchange = MockServerHttpRequest.get("/foo").toExchange();
RequestMappingInfo info = paths("/foo*", "/bar").build();
RequestMappingInfo expected = paths("/foo*").build();
assertEquals(expected, info.getMatchingCondition(exchange));
info = paths("/**", "/foo*", "/foo").build();
expected = paths("/foo", "/foo*", "/**").build();
assertEquals(expected, info.getMatchingCondition(exchange));
}
use of org.springframework.web.reactive.result.method.RequestMappingInfo in project spring-framework by spring-projects.
the class RequestMappingInfoTests method matchParamsCondition.
@Test
public void matchParamsCondition() {
ServerWebExchange exchange = MockServerHttpRequest.get("/foo?foo=bar").toExchange();
RequestMappingInfo info = paths("/foo").params("foo=bar").build();
RequestMappingInfo match = info.getMatchingCondition(exchange);
assertNotNull(match);
info = paths("/foo").params("foo!=bar").build();
match = info.getMatchingCondition(exchange);
assertNull(match);
}
use of org.springframework.web.reactive.result.method.RequestMappingInfo in project spring-framework by spring-projects.
the class RequestMappingInfoTests method matchHeadersCondition.
@Test
public void matchHeadersCondition() {
ServerWebExchange exchange = MockServerHttpRequest.get("/foo").header("foo", "bar").toExchange();
RequestMappingInfo info = paths("/foo").headers("foo=bar").build();
RequestMappingInfo match = info.getMatchingCondition(exchange);
assertNotNull(match);
info = paths("/foo").headers("foo!=bar").build();
match = info.getMatchingCondition(exchange);
assertNull(match);
}
Aggregations