Search in sources :

Example 6 with CodecConfigurer

use of cn.taketoday.http.codec.CodecConfigurer in project today-infrastructure by TAKETODAY.

the class CodecConfigurerTests method cloneEmptyCustomCodecs.

@Test
void cloneEmptyCustomCodecs() {
    this.configurer.registerDefaults(false);
    assertThat(this.configurer.getReaders()).isEmpty();
    assertThat(this.configurer.getWriters()).isEmpty();
    CodecConfigurer clone = this.configurer.clone();
    clone.customCodecs().register(new Jackson2JsonEncoder());
    clone.customCodecs().register(new Jackson2JsonDecoder());
    clone.customCodecs().register(new ServerSentEventHttpMessageReader());
    clone.customCodecs().register(new ServerSentEventHttpMessageWriter());
    assertThat(this.configurer.getReaders()).isEmpty();
    assertThat(this.configurer.getWriters()).isEmpty();
    assertThat(clone.getReaders()).hasSize(2);
    assertThat(clone.getWriters()).hasSize(2);
}
Also used : ServerSentEventHttpMessageReader(cn.taketoday.http.codec.ServerSentEventHttpMessageReader) Jackson2JsonDecoder(cn.taketoday.http.codec.json.Jackson2JsonDecoder) ServerSentEventHttpMessageWriter(cn.taketoday.http.codec.ServerSentEventHttpMessageWriter) CodecConfigurer(cn.taketoday.http.codec.CodecConfigurer) Jackson2JsonEncoder(cn.taketoday.http.codec.json.Jackson2JsonEncoder) Test(org.junit.jupiter.api.Test)

Aggregations

CodecConfigurer (cn.taketoday.http.codec.CodecConfigurer)6 ServerSentEventHttpMessageReader (cn.taketoday.http.codec.ServerSentEventHttpMessageReader)6 ServerSentEventHttpMessageWriter (cn.taketoday.http.codec.ServerSentEventHttpMessageWriter)6 Jackson2JsonDecoder (cn.taketoday.http.codec.json.Jackson2JsonDecoder)6 Jackson2JsonEncoder (cn.taketoday.http.codec.json.Jackson2JsonEncoder)6 Test (org.junit.jupiter.api.Test)6 ResolvableType (cn.taketoday.core.ResolvableType)2 ByteArrayDecoder (cn.taketoday.core.codec.ByteArrayDecoder)2 ByteArrayEncoder (cn.taketoday.core.codec.ByteArrayEncoder)2 ByteBufferDecoder (cn.taketoday.core.codec.ByteBufferDecoder)2 ByteBufferEncoder (cn.taketoday.core.codec.ByteBufferEncoder)2 CharSequenceEncoder (cn.taketoday.core.codec.CharSequenceEncoder)2 DataBufferDecoder (cn.taketoday.core.codec.DataBufferDecoder)2 DataBufferEncoder (cn.taketoday.core.codec.DataBufferEncoder)2 Decoder (cn.taketoday.core.codec.Decoder)2 Encoder (cn.taketoday.core.codec.Encoder)2 NettyByteBufDecoder (cn.taketoday.core.codec.NettyByteBufDecoder)2 NettyByteBufEncoder (cn.taketoday.core.codec.NettyByteBufEncoder)2 StringDecoder (cn.taketoday.core.codec.StringDecoder)2 MediaType (cn.taketoday.http.MediaType)2