diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e849f2c270a..9731725bc2c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -34,7 +34,7 @@ jcache = "1.1.1" junit5 = "5.10.3" junit-platform="1.10.3" logback = "1.5.8" -logbook-netty = "2.16.0" +logbook-netty = "3.7.0" log4j = "2.23.1" micronaut-aws = "4.7.1" micronaut-build-plugins="7.2.1" diff --git a/src/main/docs/guide/httpServer/serverConfiguration/nettyClientPipeline.adoc b/src/main/docs/guide/httpServer/serverConfiguration/nettyClientPipeline.adoc index 34005ee9907..8b94ac90a4c 100644 --- a/src/main/docs/guide/httpServer/serverConfiguration/nettyClientPipeline.adoc +++ b/src/main/docs/guide/httpServer/serverConfiguration/nettyClientPipeline.adoc @@ -11,5 +11,3 @@ snippet::io.micronaut.docs.netty.LogbookNettyClientCustomizer[tags="imports,clas <3> The actual customizer implements api:http.client.netty.NettyClientCustomizer[] <4> When a new channel is created, a new, specialized customizer is created for that channel <5> When the client signals that the stream pipeline has been fully constructed, the logbook handler is registered - -WARNING: Logbook has a https://github.com/zalando/logbook/issues/1216[major bug] that limits its usefulness with netty. diff --git a/test-suite/src/test/groovy/io/micronaut/docs/netty/LogbookNettyClientCustomizerSpec.groovy b/test-suite/src/test/groovy/io/micronaut/docs/netty/LogbookNettyClientCustomizerSpec.groovy index 2f7e6b96ee9..4132d73a19e 100644 --- a/test-suite/src/test/groovy/io/micronaut/docs/netty/LogbookNettyClientCustomizerSpec.groovy +++ b/test-suite/src/test/groovy/io/micronaut/docs/netty/LogbookNettyClientCustomizerSpec.groovy @@ -12,38 +12,7 @@ import io.micronaut.http.annotation.Get import io.micronaut.http.annotation.Post import io.micronaut.http.annotation.Produces import io.micronaut.http.client.HttpClient -import io.micronaut.http.netty.channel.ChannelPipelineCustomizer -import io.micronaut.http.server.netty.NettyHttpServer import io.micronaut.runtime.server.EmbeddedServer -import io.netty.buffer.Unpooled -import io.netty.channel.ChannelHandlerContext -import io.netty.channel.ChannelOutboundHandlerAdapter -import io.netty.channel.ChannelPromise -import io.netty.channel.embedded.EmbeddedChannel -import io.netty.handler.codec.http.DefaultFullHttpRequest -import io.netty.handler.codec.http.FullHttpResponse -import io.netty.handler.codec.http.HttpClientCodec -import io.netty.handler.codec.http.HttpClientUpgradeHandler -import io.netty.handler.codec.http.HttpHeaderNames -import io.netty.handler.codec.http.HttpHeaderValues -import io.netty.handler.codec.http.HttpMethod -import io.netty.handler.codec.http.HttpObjectAggregator -import io.netty.handler.codec.http.HttpResponseStatus -import io.netty.handler.codec.http.HttpVersion -import io.netty.handler.codec.http2.DefaultHttp2Connection -import io.netty.handler.codec.http2.DelegatingDecompressorFrameListener -import io.netty.handler.codec.http2.Http2ClientUpgradeCodec -import io.netty.handler.codec.http2.Http2SecurityUtil -import io.netty.handler.codec.http2.Http2Settings -import io.netty.handler.codec.http2.HttpConversionUtil -import io.netty.handler.codec.http2.HttpToHttp2ConnectionHandlerBuilder -import io.netty.handler.codec.http2.InboundHttp2ToHttpAdapterBuilder -import io.netty.handler.ssl.ApplicationProtocolConfig -import io.netty.handler.ssl.ApplicationProtocolNames -import io.netty.handler.ssl.ApplicationProtocolNegotiationHandler -import io.netty.handler.ssl.SslContextBuilder -import io.netty.handler.ssl.SupportedCipherSuiteFilter -import io.netty.handler.ssl.util.InsecureTrustManagerFactory import jakarta.inject.Singleton import org.zalando.logbook.HttpRequest import org.zalando.logbook.HttpResponse @@ -52,8 +21,6 @@ import org.zalando.logbook.Origin import org.zalando.logbook.Strategy import spock.lang.Specification -import java.nio.charset.StandardCharsets - class LogbookNettyClientCustomizerSpec extends Specification { def 'plaintext http 1'() { given: @@ -183,6 +150,22 @@ class LogbookNettyClientCustomizerSpec extends Specification { ] } + @Controller("/logbook/logged") + @Requires(property = 'spec.name', value = 'LogbookNettyClientCustomizerSpec') + static class LoggedController { + @Get("/") + @Produces(MediaType.TEXT_PLAIN) + String index() { + return "hello" + } + + @Post("/") + @Produces(MediaType.TEXT_PLAIN) + String index(@Body String body) { + return body + } + } + @Requires(property = 'spec.name', value = 'LogbookNettyClientCustomizerSpec') @Factory static class LogbookFactory { diff --git a/test-suite/src/test/groovy/io/micronaut/docs/netty/LogbookNettyServerCustomizerSpec.groovy b/test-suite/src/test/groovy/io/micronaut/docs/netty/LogbookNettyServerCustomizerSpec.groovy index 55fdbc6c6d5..ec55f1c11fe 100644 --- a/test-suite/src/test/groovy/io/micronaut/docs/netty/LogbookNettyServerCustomizerSpec.groovy +++ b/test-suite/src/test/groovy/io/micronaut/docs/netty/LogbookNettyServerCustomizerSpec.groovy @@ -342,8 +342,7 @@ class LogbookNettyServerCustomizerSpec extends Specification { 'POST /logbook/logged', 'bar', '200', - // second response body not included because of logbook bug: https://github.com/zalando/logbook/issues/1216 - //'bar', + 'bar', ] cleanup: @@ -484,6 +483,7 @@ class LogbookNettyServerCustomizerSpec extends Specification { } @Controller("/logbook/logged") + @Requires(property = 'spec.name', value = 'LogbookNettyServerCustomizerSpec') static class LoggedController { @Get("/") @Produces(MediaType.TEXT_PLAIN)