Skip to content

Commit

Permalink
Remove warning about Logbook bug (#10118)
Browse files Browse the repository at this point in the history
* Remove warning about Logbook bug

* logbook to 3.6.0

* close context

* add missing @requires

* Fix failing tests

* Bump Logbook version

* readd requires

---------

Co-authored-by: Sergio del Amo <[email protected]>
Co-authored-by: yawkat <[email protected]>
  • Loading branch information
3 people authored Oct 7, 2024
1 parent ad28340 commit 4236bf1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 38 deletions.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 4236bf1

Please sign in to comment.