[英]Spring Webflux Reactor Netty: HTTP Request/Response Hex Dump?
What log level we have to set in application.properties in order to see the full HTTP request and response with headers and body as a hex dump in the console from reactor-netty? 我们必须在application.properties中设置什么日志级别,以查看完整的HTTP请求和带有标头和正文的响应,作为控制台中来自Reactor-Netty的十六进制转储 ?
logging.level.reactor.netty=trace
Only shows response http headers. 仅显示响应http标头。
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 248
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-XSS-Protection: 1 ; mode=block
Referrer-Policy: no-referrer
Keep the logging level as DEBUG or TRACE and follow the instructions below: 保持日志记录级别为DEBUG或TRACE,并按照以下说明进行操作:
hex dump
for the server then you can customise it like this: 如果要查看服务器的hex dump
,则可以像这样自定义它: @Component
public class MyNettyWebServerCustomizer
implements WebServerFactoryCustomizer<NettyReactiveWebServerFactory> {
@Override
public void customize(NettyReactiveWebServerFactory factory) {
factory.addServerCustomizers(httpServer -> httpServer.wiretap(true));
}
}
hex dump
for the client then you can customise it like this: 如果要查看客户端的hex dump
,则可以像这样自定义它: WebClient.builder()
.clientConnector(new ReactorClientHttpConnector(HttpClient.create().wiretap(true)))
.build();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.