Skip to content

Commit 2f1cd9a

Browse files
committed
Spring WebClient retrieve() vs exchange()
1 parent c8ef6f2 commit 2f1cd9a

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

spring-reactive-modules/spring-reactive-client-2/src/main/java/com/baeldung/webclientretrievevsexchange/RetrieveAndExchangeController.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Mono<User> retrieveOneUser(@PathVariable int id) {
2929
}
3030

3131
@GetMapping("/user-status/{id}")
32-
Mono<User> retrieveOneUserAndHandleErrorBaseOnStatus(@PathVariable int id) {
32+
Mono<User> retrieveOneUserAndHandleErrorBasedOnStatus(@PathVariable int id) {
3333
return client.get()
3434
.uri("/{id}", id)
3535
.retrieve()
@@ -76,10 +76,6 @@ Mono<User> retrieveUsersWithExchangeAndError(@PathVariable int id) {
7676
.exchangeToMono(res -> {
7777
if (res.statusCode()
7878
.is2xxSuccessful()) {
79-
logger.info("Status code: " + res.headers()
80-
.asHttpHeaders());
81-
logger.info("Content-type" + res.headers()
82-
.contentType());
8379
return res.bodyToMono(User.class);
8480
} else if (res.statusCode()
8581
.is4xxClientError()) {

0 commit comments

Comments
 (0)