Search in sources :

Example 1 with DefaultClientCodecConfigurer

use of org.springframework.http.codec.support.DefaultClientCodecConfigurer in project spring-boot by spring-projects.

the class CodecsAutoConfigurationTests method loggingRequestDetailsCustomizerShouldUseHttpProperties.

@Test
void loggingRequestDetailsCustomizerShouldUseHttpProperties() {
    this.contextRunner.withPropertyValues("spring.codec.log-request-details=true").run((context) -> {
        CodecCustomizer customizer = context.getBean(CodecCustomizer.class);
        CodecConfigurer configurer = new DefaultClientCodecConfigurer();
        customizer.customize(configurer);
        assertThat(configurer.defaultCodecs()).hasFieldOrPropertyWithValue("enableLoggingRequestDetails", true);
    });
}
Also used : DefaultClientCodecConfigurer(org.springframework.http.codec.support.DefaultClientCodecConfigurer) CodecCustomizer(org.springframework.boot.web.codec.CodecCustomizer) CodecConfigurer(org.springframework.http.codec.CodecConfigurer) DefaultClientCodecConfigurer(org.springframework.http.codec.support.DefaultClientCodecConfigurer) Test(org.junit.jupiter.api.Test)

Example 2 with DefaultClientCodecConfigurer

use of org.springframework.http.codec.support.DefaultClientCodecConfigurer in project spring-boot by spring-projects.

the class CodecsAutoConfigurationTests method maxInMemorySizeEnforcedInDefaultCodecs.

@Test
void maxInMemorySizeEnforcedInDefaultCodecs() {
    this.contextRunner.withPropertyValues("spring.codec.max-in-memory-size=1MB").run((context) -> {
        CodecCustomizer customizer = context.getBean(CodecCustomizer.class);
        CodecConfigurer configurer = new DefaultClientCodecConfigurer();
        customizer.customize(configurer);
        assertThat(configurer.defaultCodecs()).hasFieldOrPropertyWithValue("maxInMemorySize", 1048576);
    });
}
Also used : DefaultClientCodecConfigurer(org.springframework.http.codec.support.DefaultClientCodecConfigurer) CodecCustomizer(org.springframework.boot.web.codec.CodecCustomizer) CodecConfigurer(org.springframework.http.codec.CodecConfigurer) DefaultClientCodecConfigurer(org.springframework.http.codec.support.DefaultClientCodecConfigurer) Test(org.junit.jupiter.api.Test)

Example 3 with DefaultClientCodecConfigurer

use of org.springframework.http.codec.support.DefaultClientCodecConfigurer in project spring-boot by spring-projects.

the class CodecsAutoConfigurationTests method autoConfigShouldProvideALoggingRequestDetailsCustomizer.

@Test
void autoConfigShouldProvideALoggingRequestDetailsCustomizer() {
    this.contextRunner.run((context) -> {
        CodecCustomizer customizer = context.getBean(CodecCustomizer.class);
        CodecConfigurer configurer = new DefaultClientCodecConfigurer();
        customizer.customize(configurer);
        assertThat(configurer.defaultCodecs()).hasFieldOrPropertyWithValue("enableLoggingRequestDetails", false);
    });
}
Also used : DefaultClientCodecConfigurer(org.springframework.http.codec.support.DefaultClientCodecConfigurer) CodecCustomizer(org.springframework.boot.web.codec.CodecCustomizer) CodecConfigurer(org.springframework.http.codec.CodecConfigurer) DefaultClientCodecConfigurer(org.springframework.http.codec.support.DefaultClientCodecConfigurer) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)3 CodecCustomizer (org.springframework.boot.web.codec.CodecCustomizer)3 CodecConfigurer (org.springframework.http.codec.CodecConfigurer)3 DefaultClientCodecConfigurer (org.springframework.http.codec.support.DefaultClientCodecConfigurer)3