parent
69aed83504
commit
1e19e51c9c
|
|
@ -554,10 +554,12 @@ depending on the response status:
|
||||||
return response.bodyToMono(Person.class);
|
return response.bodyToMono(Person.class);
|
||||||
}
|
}
|
||||||
else if (response.statusCode().is4xxClientError()) {
|
else if (response.statusCode().is4xxClientError()) {
|
||||||
|
// Suppress error status code
|
||||||
return response.bodyToMono(ErrorContainer.class);
|
return response.bodyToMono(ErrorContainer.class);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return Mono.error(response.createException());
|
// Turn to error
|
||||||
|
return response.createException().flatMap(Mono::error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
----
|
----
|
||||||
|
|
@ -569,13 +571,13 @@ depending on the response status:
|
||||||
.accept(MediaType.APPLICATION_JSON)
|
.accept(MediaType.APPLICATION_JSON)
|
||||||
.awaitExchange {
|
.awaitExchange {
|
||||||
if (response.statusCode() == HttpStatus.OK) {
|
if (response.statusCode() == HttpStatus.OK) {
|
||||||
return response.awaitBody<Person>();
|
return response.awaitBody<Person>()
|
||||||
}
|
}
|
||||||
else if (response.statusCode().is4xxClientError) {
|
else if (response.statusCode().is4xxClientError) {
|
||||||
return response.awaitBody<ErrorContainer>();
|
return response.awaitBody<ErrorContainer>()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return response.createExceptionAndAwait();
|
throw response.createExceptionAndAwait()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
----
|
----
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue