.retrieve() //
.onStatus(HttpStatus::isError,
response -> Mono.error(new AsyncRestClientException(response.statusCode().toString()))) //
- .bodyToMono(String.class);
+ .bodyToMono(String.class) //
+ .defaultIfEmpty("");
}
public Mono<String> postWithAuthHeader(String uri, String body, String username, String password) {
.retrieve() //
.onStatus(HttpStatus::isError,
response -> Mono.error(new AsyncRestClientException(response.statusCode().toString()))) //
- .bodyToMono(String.class);
+ .bodyToMono(String.class) //
+ .defaultIfEmpty("");
}
public Mono<String> put(String uri, String body) {
.retrieve() //
.onStatus(HttpStatus::isError,
response -> Mono.error(new AsyncRestClientException(response.statusCode().toString()))) //
- .bodyToMono(String.class);
+ .bodyToMono(String.class) //
+ .defaultIfEmpty("");
}
public Mono<String> get(String uri) {
.retrieve() //
.onStatus(HttpStatus::isError,
response -> Mono.error(new AsyncRestClientException(response.statusCode().toString()))) //
- .bodyToMono(String.class);
+ .bodyToMono(String.class) //
+ .defaultIfEmpty("");
}
public Mono<String> delete(String uri) {
.retrieve() //
.onStatus(HttpStatus::isError,
response -> Mono.error(new AsyncRestClientException(response.statusCode().toString()))) //
- .bodyToMono(String.class);
+ .bodyToMono(String.class) //
+ .defaultIfEmpty("");
}
}