I am using the webclient from spring webflux, like this :
WebClient.create() .post() .uri(url) .syncBody(body) .accept(MediaType.APPLICATION_JSON) .headers(headers) .exchange() .flatMap(clientResponse -> clientResponse.bodyToMono(tClass));
It is working well. I now want to handle the error from the webservice I am calling (Ex 500 internal error). Normally i would add an doOnError on the "stream" and isu the Throwable to test the status code,
But my issue is that I want to get the body provided by the webservice because it is providing me a message that i would like to use.
I am looking to do the flatMap whatever happen and test myself the status code to deserialize or not the body.