Test compression with invalid content type for all webservers
Closes gh-18338
This commit is contained in:
parent
12751fe50a
commit
d89adfac91
|
@ -16,7 +16,6 @@
|
|||
|
||||
package org.springframework.boot.web.embedded.netty;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.junit.Test;
|
||||
|
@ -25,10 +24,7 @@ import reactor.netty.http.server.HttpServer;
|
|||
|
||||
import org.springframework.boot.web.reactive.server.AbstractReactiveWebServerFactory;
|
||||
import org.springframework.boot.web.reactive.server.AbstractReactiveWebServerFactoryTests;
|
||||
import org.springframework.boot.web.server.Compression;
|
||||
import org.springframework.boot.web.server.PortInUseException;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
|
@ -87,15 +83,4 @@ public class NettyReactiveWebServerFactoryTests extends AbstractReactiveWebServe
|
|||
assertForwardHeaderIsUsed(factory);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void noCompressionForResponseWithInvalidContentType() {
|
||||
Compression compression = new Compression();
|
||||
compression.setEnabled(true);
|
||||
compression.setMimeTypes(new String[] { "application/json" });
|
||||
WebClient client = prepareCompressionTest(compression, "test~plain");
|
||||
ResponseEntity<Void> response = client.get().exchange().flatMap((res) -> res.toEntity(Void.class))
|
||||
.block(Duration.ofSeconds(30));
|
||||
assertResponseIsNotCompressed(response);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -278,6 +278,17 @@ public abstract class AbstractReactiveWebServerFactoryTests {
|
|||
assertResponseIsNotCompressed(response);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void noCompressionForResponseWithInvalidContentType() {
|
||||
Compression compression = new Compression();
|
||||
compression.setEnabled(true);
|
||||
compression.setMimeTypes(new String[] { "application/json" });
|
||||
WebClient client = prepareCompressionTest(compression, "test~plain");
|
||||
ResponseEntity<Void> response = client.get().exchange().flatMap((res) -> res.toEntity(Void.class))
|
||||
.block(Duration.ofSeconds(30));
|
||||
assertResponseIsNotCompressed(response);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenSslIsEnabledAndNoKeyStoreIsConfiguredThenServerFailsToStart() {
|
||||
assertThatThrownBy(() -> testBasicSslWithKeyStore(null, null))
|
||||
|
|
Loading…
Reference in New Issue