@@ -462,12 +462,20 @@ At this level, you can also create a full `ResponseEntity`:
462
462
Note that (unlike `retrieve()`), with `exchange()`, there are no automatic error signals for
463
463
4xx and 5xx responses. You have to check the status code and decide how to proceed.
464
464
465
- CAUTION: When you use `exchange()`, you must always use any of the `body` or `toEntity` methods of
466
- `ClientResponse` to ensure resources are released and to avoid potential issues with HTTP
467
- connection pooling. You can use `bodyToMono(Void.class)` if no response content is
468
- expected. However, if the response does have content, the connection
469
- is closed and is not placed back in the pool.
470
-
465
+ [CAUTION]
466
+ ====
467
+ When using `exchange()`, you have to make sure that the body is always consumed or released,
468
+ even when an exception occurs (see <<core.adoc#databuffers-using,Using DataBuffer>>).
469
+ Typically, you do this by invoking either `bodyTo*` or `toEntity*` on `ClientResponse`
470
+ to convert the body into an object of the desired type, but
471
+ you can also invoke `releaseBody()` to discard the body contents without consuming it or
472
+ `toBodilessEntity()` to get just the status and headers (while discarding the body).
473
+
474
+ Finally, there is `bodyToMono(Void.class)`, which should only be used if no response content is
475
+ expected.
476
+ If the response does have content, the connection is closed and is not placed back in the pool,
477
+ because it is not left in a reusable state.
478
+ ====
471
479
472
480
473
481
0 commit comments