Skip to content

Commit

Permalink
added more common exchangeToMono example for article
Browse files Browse the repository at this point in the history
  • Loading branch information
rozagerardo committed Jan 26, 2021
1 parent 23f8b0a commit 2073a63
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,18 @@ public void givenDifferentScenarios_whenRequestsSent_thenObtainExpectedResponses
.bodyToMono(String.class);
Mono<String> responsePostWithBody2 = headerSpecPost2.retrieve()
.bodyToMono(String.class);
Mono<String> responsePostWithBody3 = headerSpecPost3.retrieve()
.bodyToMono(String.class);
Mono<String> responsePostWithBody3 = headerSpecPost3.exchangeToMono(response -> {
if (response.statusCode()
.equals(HttpStatus.OK)) {
return response.bodyToMono(String.class);
} else if (response.statusCode()
.is4xxClientError()) {
return Mono.just("Error response");
} else {
return response.createException()
.flatMap(Mono::error);
}
});
Mono<String> responsePostFoo = headerSpecFooPost.retrieve()
.bodyToMono(String.class);
ParameterizedTypeReference<Map<String, String>> ref = new ParameterizedTypeReference<Map<String, String>>() {
Expand Down

0 comments on commit 2073a63

Please sign in to comment.