use of org.springframework.mock.http.server.reactive.test.MockServerWebExchange in project spring-framework by spring-projects.
the class HeadersRequestConditionTests method headerValueMatch.
@Test
public void headerValueMatch() throws Exception {
MockServerWebExchange exchange = MockServerHttpRequest.get("/").header("foo", "bar").toExchange();
HeadersRequestCondition condition = new HeadersRequestCondition("foo=bar");
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 headerValueNoMatch.
@Test
public void headerValueNoMatch() throws Exception {
MockServerWebExchange exchange = MockServerHttpRequest.get("/").header("foo", "bazz").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 HeadersRequestConditionTests method headerValueMatchNegated.
@Test
public void headerValueMatchNegated() throws Exception {
MockServerWebExchange exchange = MockServerHttpRequest.get("/").header("foo", "baz").toExchange();
HeadersRequestCondition condition = new HeadersRequestCondition("foo!=bar");
assertNotNull(condition.getMatchingCondition(exchange));
}
use of org.springframework.mock.http.server.reactive.test.MockServerWebExchange in project spring-framework by spring-projects.
the class ResourceWebHandlerTests method doOverwriteExistingCacheControlHeaders.
// SPR-14005
@Test
public void doOverwriteExistingCacheControlHeaders() throws Exception {
MockServerWebExchange exchange = MockServerHttpRequest.get("").toExchange();
exchange.getResponse().getHeaders().setCacheControl(CacheControl.noStore().getHeaderValue());
setPathWithinHandlerMapping(exchange, "foo.css");
this.handler.handle(exchange).block(TIMEOUT);
assertEquals("max-age=3600", exchange.getResponse().getHeaders().getCacheControl());
}
use of org.springframework.mock.http.server.reactive.test.MockServerWebExchange in project spring-framework by spring-projects.
the class ResourceWebHandlerTests method notModified.
@Test
public void notModified() throws Exception {
MockServerWebExchange exchange = MockServerHttpRequest.get("").ifModifiedSince(resourceLastModified("test/foo.css")).toExchange();
setPathWithinHandlerMapping(exchange, "foo.css");
this.handler.handle(exchange).block(TIMEOUT);
assertEquals(HttpStatus.NOT_MODIFIED, exchange.getResponse().getStatusCode());
}
Aggregations