You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the client is used and a 40X or 50X response occurs, then the WebClient throws a WebClientResponseException - which is unexpected - as I would think that having specified Mono<ResponseEntity<Foo>> as the return type would have returned a ResponseEntity with status 40X or 50X (acknowledging the reactive component of this).
Looking at the factory code, it is aware of the return type, and therefore I would expect a response that is consistent with the declared return type - in other words, a Mono<ResponseEntity<Foo>>.
I have not found a way to work around this - meaning obtaining a behavior consistent with the return type - in the same manner that exchange() would work. This is another odd part of this, as exchange() is deprecated and we now work with exchangeToMono() - which is distinctly a client feature that seems too low level to be a part of HTTP interface clients. So maybe - works as designed?
Instead, I've had to use the normal handling of errors to 'coerce' the behavior I want for a given method. With this, I can do what I want, but it seems this may be a bug - or something that can be clarified in the documentation.
The text was updated successfully, but these errors were encountered:
@amoffet the official way around this is to customize the underlying WebClient, as described in the HTTP interface client documentation's error handling section
Affects: Spring Web 6.1.X
Given a simple method in
FooInterface
such aswith a 'standard' WebClient backing it.
The factory is also 'generic':
When the client is used and a 40X or 50X response occurs, then the WebClient throws a
WebClientResponseException
- which is unexpected - as I would think that having specifiedMono<ResponseEntity<Foo>>
as the return type would have returned a ResponseEntity with status 40X or 50X (acknowledging the reactive component of this).Looking at the factory code, it is aware of the return type, and therefore I would expect a response that is consistent with the declared return type - in other words, a
Mono<ResponseEntity<Foo>>
.I have not found a way to work around this - meaning obtaining a behavior consistent with the return type - in the same manner that
exchange()
would work. This is another odd part of this, asexchange()
is deprecated and we now work withexchangeToMono()
- which is distinctly aclient
feature that seems too low level to be a part of HTTP interface clients. So maybe - works as designed?Instead, I've had to use the normal handling of errors to 'coerce' the behavior I want for a given method. With this, I can do what I want, but it seems this may be a bug - or something that can be clarified in the documentation.
The text was updated successfully, but these errors were encountered: