Search in sources :

Example 1 with EncodedResource

use of org.springframework.web.reactive.resource.EncodedResourceResolver.EncodedResource in project spring-framework by spring-projects.

the class CssLinkResourceTransformerTests method transformSkippedForGzippedResource.

@Test
public void transformSkippedForGzippedResource(GzippedFiles gzippedFiles) throws Exception {
    gzippedFiles.create("main.css");
    MockServerWebExchange exchange = MockServerWebExchange.from(get("/static/main.css"));
    Resource resource = getResource("main.css");
    EncodedResource gzipped = new EncodedResource(resource, "gzip", ".gz");
    StepVerifier.create(this.transformerChain.transform(exchange, gzipped)).expectNext(gzipped).expectComplete().verify();
}
Also used : ClassPathResource(org.springframework.core.io.ClassPathResource) EncodedResource(org.springframework.web.reactive.resource.EncodedResourceResolver.EncodedResource) Resource(org.springframework.core.io.Resource) MockServerWebExchange(org.springframework.web.testfixture.server.MockServerWebExchange) EncodedResource(org.springframework.web.reactive.resource.EncodedResourceResolver.EncodedResource) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)1 ClassPathResource (org.springframework.core.io.ClassPathResource)1 Resource (org.springframework.core.io.Resource)1 EncodedResource (org.springframework.web.reactive.resource.EncodedResourceResolver.EncodedResource)1 MockServerWebExchange (org.springframework.web.testfixture.server.MockServerWebExchange)1