use of org.springframework.mock.http.server.reactive.test.MockServerWebExchange in project spring-framework by spring-projects.
the class ResourceWebHandlerTests method partialContentSuffixRange.
@Test
public void partialContentSuffixRange() throws Exception {
MockServerWebExchange exchange = MockServerHttpRequest.get("").header("range", "bytes=-1").toExchange();
setPathWithinHandlerMapping(exchange, "foo.txt");
this.handler.handle(exchange).block(TIMEOUT);
assertEquals(HttpStatus.PARTIAL_CONTENT, exchange.getResponse().getStatusCode());
assertEquals(MediaType.TEXT_PLAIN, exchange.getResponse().getHeaders().getContentType());
assertEquals(1, exchange.getResponse().getHeaders().getContentLength());
assertEquals("bytes 9-9/10", exchange.getResponse().getHeaders().getFirst("Content-Range"));
assertEquals("bytes", exchange.getResponse().getHeaders().getFirst("Accept-Ranges"));
assertEquals(1, exchange.getResponse().getHeaders().get("Accept-Ranges").size());
assertResponseBody(exchange, ".");
}
use of org.springframework.mock.http.server.reactive.test.MockServerWebExchange in project spring-framework by spring-projects.
the class ResourceWebHandlerTests method unsupportedHttpMethod.
@Test(expected = MethodNotAllowedException.class)
public void unsupportedHttpMethod() throws Exception {
MockServerWebExchange exchange = MockServerHttpRequest.post("").toExchange();
setPathWithinHandlerMapping(exchange, "foo.css");
this.handler.handle(exchange).block(TIMEOUT);
}
use of org.springframework.mock.http.server.reactive.test.MockServerWebExchange in project spring-framework by spring-projects.
the class HeadersRequestConditionTests method headerNotPresent.
@Test
public void headerNotPresent() throws Exception {
MockServerWebExchange exchange = MockServerHttpRequest.get("/").toExchange();
HeadersRequestCondition condition = new HeadersRequestCondition("!accept");
assertNotNull(condition.getMatchingCondition(exchange));
}
use of org.springframework.mock.http.server.reactive.test.MockServerWebExchange in project spring-framework by spring-projects.
the class HeadersRequestConditionTests method headerValueNoMatchNegated.
@Test
public void headerValueNoMatchNegated() throws Exception {
MockServerWebExchange exchange = MockServerHttpRequest.get("/").header("foo", "bar").toExchange();
HeadersRequestCondition condition = new HeadersRequestCondition("foo!=bar");
assertNull(condition.getMatchingCondition(exchange));
}
use of org.springframework.mock.http.server.reactive.test.MockServerWebExchange in project spring-framework by spring-projects.
the class ParamsRequestConditionTests method paramNotPresent.
@Test
public void paramNotPresent() throws Exception {
MockServerWebExchange exchange = get("/").toExchange();
assertNotNull(new ParamsRequestCondition("!foo").getMatchingCondition(exchange));
}
Aggregations