Skip to content

Conversation

@denysivano
Copy link

@denysivano denysivano commented May 13, 2018

These changes are aimed to improve handling of unknown status codes by reactive WebClient.

In ClientResponse the getRawStatusCode() method was introduced that allows to obtain raw status code value from response after the corresponding method in reactive ClientHttpResponse was provided (see SPR-16748).

Also the retrieve() method in default WebClient implementation and statusError() in ExchangeFilterFunctions were changed in order to provide support of unknown status codes. The new onStatusCode() (WebClient.ResponseSpec) and statusCodeError() (ExchangeFilterFunctions) methods allow to specify exception function which should be applied on matching the status code (int value) against the specified predicate. The StatusCodePredicates provides convenient way to create predicates for these methods.

https://jira.spring.io/browse/SPR-16819

Prior to this commit, `WebClient.RequestHeadersSpec.retrieve()` always throw
`IllegalArgumentException` on unknown status codes. This commit improves support
of unkwnown status codes and introduces new method - `onStatusCode`, which
allows to apply response error handling for status codes that can't be resolved
through `HttpStatus`. New class `StatusCodePredicates` provides convenient way
to create predicates for `onStatusCode` method.

Issue: SPR-16819
@bclozel bclozel self-assigned this Jul 11, 2018
@bclozel
Copy link
Member

bclozel commented Jul 12, 2018

Merged with 038af9a, see comment on the SPR issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants