I've started using WebClient and I'm adding logging of request/response and I'm using filter method when constructing WebClient:
WebClient.builder()
.baseUrl(properties.getEndpoint())
.filter((request, next) -> {
// logging
request.body()
})
.build();
Run Code Online (Sandbox Code Playgroud)
I'm able to access url, http method, headers but I've a problem with getting raw request body as body() method of request returns BodyInserter (BodyInserter<?, ? super ClientHttpRequest> body().
How to convert BodyInserter to String representation of request body? Alternatively, how to properly log whole request/response while also being …