I have a request like this:
public ResponseEntity<JsonNode> test(String id) {
return WebClient
.create("http://localhost:8090/database/api")
.get()
.uri("/test/{id}", id)
.accept(MediaType.APPLICATION_JSON)
.exchange()
.flatMap(resp -> resp.toEntity(JsonNode.class))
.block();
}
Works fine when request is ok (HttpStatus code 200)
How I return the same Body and HttpStatus Code when error happen
I solved it this way:
The problem was the lack of a block () after exchange().