use of org.springframework.web.server.ServerWebExchange in project spring-framework by spring-projects.
the class RequestMethodsRequestConditionTests method testMatch.
private void testMatch(RequestMethodsRequestCondition condition, RequestMethod method) throws Exception {
ServerWebExchange exchange = getExchange(method.name());
RequestMethodsRequestCondition actual = condition.getMatchingCondition(exchange);
assertNotNull(actual);
assertEquals(Collections.singleton(method), actual.getContent());
}
use of org.springframework.web.server.ServerWebExchange in project spring-framework by spring-projects.
the class RequestMethodsRequestConditionTests method testNoMatch.
private void testNoMatch(RequestMethodsRequestCondition condition, RequestMethod method) throws Exception {
ServerWebExchange exchange = getExchange(method.name());
assertNull(condition.getMatchingCondition(exchange));
}
use of org.springframework.web.server.ServerWebExchange in project spring-framework by spring-projects.
the class RequestMethodsRequestConditionTests method getMatchingConditionWithEmptyConditions.
@Test
public void getMatchingConditionWithEmptyConditions() throws Exception {
RequestMethodsRequestCondition condition = new RequestMethodsRequestCondition();
for (RequestMethod method : RequestMethod.values()) {
if (!OPTIONS.equals(method)) {
ServerWebExchange exchange = getExchange(method.name());
assertNotNull(condition.getMatchingCondition(exchange));
}
}
testNoMatch(condition, OPTIONS);
}
use of org.springframework.web.server.ServerWebExchange in project spring-framework by spring-projects.
the class RequestMappingInfoHandlerMappingTests method handleMatchMatrixVariablesDecoding.
@Test
public void handleMatchMatrixVariablesDecoding() throws Exception {
HttpRequestPathHelper urlPathHelper = new HttpRequestPathHelper();
urlPathHelper.setUrlDecode(false);
this.handlerMapping.setPathHelper(urlPathHelper);
ServerWebExchange exchange = get("/").toExchange();
handleMatch(exchange, "/path{filter}", "/path;mvar=a%2fb");
MultiValueMap<String, String> matrixVariables = getMatrixVariables(exchange, "filter");
Map<String, String> uriVariables = getUriTemplateVariables(exchange);
assertNotNull(matrixVariables);
assertEquals(Collections.singletonList("a/b"), matrixVariables.get("mvar"));
assertEquals(";mvar=a/b", uriVariables.get("filter"));
}
use of org.springframework.web.server.ServerWebExchange in project spring-framework by spring-projects.
the class RequestMappingInfoHandlerMappingTests method getHandlerTestInvalidContentType.
@Test
public void getHandlerTestInvalidContentType() throws Exception {
ServerWebExchange exchange = MockServerHttpRequest.put("/person/1").header("content-type", "bogus").toExchange();
Mono<Object> mono = this.handlerMapping.getHandler(exchange);
assertError(mono, UnsupportedMediaTypeStatusException.class, ex -> assertEquals("Request failure [status: 415, " + "reason: \"Invalid mime type \"bogus\": does not contain '/'\"]", ex.getMessage()));
}
Aggregations