Skip to content

Document that WebClient defaultStatusHandler do not apply to exchange* methods #30059

@rubasace

Description

@rubasace

As the title states, the behavior of WebClient.Builder.defaultStatusHandler() seems inconsistent. If I'm setting a default status handler my expectation is that it handles the status regardless of how the call is done by the client. This becomes particularly important when customizing the builder from a common library, as I need to enforce that the default handling always takes place; Prior to Spring Framework 6 and Spring Boot 3, this could be done via an ExchangeFilterFunction. Now, things get more complicated as exceptions thrown from the exchange filter functions affect the actuator observations, forcing me to override quite some methods just to be able to not lose the response HTTP status on them.

As for documentation, I couldn't find anywhere where this is documented either and, on StackOverflow answers, everything seems to indicate that retrieve() is just a simplification of the exchangeTo* methods when we don't care about more granular control.

Taking all the above into consideration, I'm wondering if there's a good reason why defaultStatusHandler() does only apply to retrieve() calls. Even if that were the case, I think this should be somehow stated in the documentation.

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: documentationA documentation task

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions