use of org.springframework.http.codec.support.DefaultServerCodecConfigurer in project spring-boot by spring-projects.
the class ReactiveMultipartAutoConfigurationTests method shouldConfigureMultipartProperties.
@Test
void shouldConfigureMultipartProperties() {
this.contextRunner.withPropertyValues("spring.webflux.multipart.streaming:true", "spring.webflux.multipart.max-in-memory-size=1GB", "spring.webflux.multipart.max-headers-size=16KB", "spring.webflux.multipart.max-disk-usage-per-part=100MB", "spring.webflux.multipart.max-parts=7", "spring.webflux.multipart.headers-charset:UTF_16").run((context) -> {
CodecCustomizer customizer = context.getBean(CodecCustomizer.class);
DefaultServerCodecConfigurer configurer = new DefaultServerCodecConfigurer();
customizer.customize(configurer);
DefaultPartHttpMessageReader partReader = getPartReader(configurer);
assertThat(partReader).hasFieldOrPropertyWithValue("streaming", true);
assertThat(partReader).hasFieldOrPropertyWithValue("maxParts", 7);
assertThat(partReader).hasFieldOrPropertyWithValue("maxHeadersSize", Math.toIntExact(DataSize.ofKilobytes(16).toBytes()));
assertThat(partReader).hasFieldOrPropertyWithValue("headersCharset", StandardCharsets.UTF_16);
assertThat(partReader).hasFieldOrPropertyWithValue("maxInMemorySize", Math.toIntExact(DataSize.ofGigabytes(1).toBytes()));
assertThat(partReader).hasFieldOrPropertyWithValue("maxDiskUsagePerPart", DataSize.ofMegabytes(100).toBytes());
});
}
Aggregations