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
Currently, there are some issues with using WebClient for calling HTTP services which return unknown status codes (couldn't be resolved through HttpStatus enum).
ClientResponse interface doesn't provide an opportunity to obtain status code value as int. Using exchange() method is safe with unknown status codes, but the raw status code value couldn't be obtained without reflexion. In 5.0.6 the method getRawStatusCode() was introduced in ClientHttpResponse (see No support for non-standard HTTP status codes in reactive ClientHttpResponse [SPR-16748] #21289). DefaultClientResponse (default implementation of ClientResponse) wraps ClientHttpResponse, so the status code can be obtained by introducing new method in reactive ClientResponse interface.
It's not possible to use retrieve() with unknown status codes because it always throws IllegalArgumentException:
That's because the default implementation uses error handling based on HttpStatus enum value. It would be a good idea to use raw status value instead and provide an opportunity to register error handlers based on raw status code value.
I've submited PR 1829 which is going to resolve these issues.
Denys Ivano opened SPR-16819 and commented
Currently, there are some issues with using
WebClientfor calling HTTP services which return unknown status codes (couldn't be resolved throughHttpStatusenum).ClientResponseinterface doesn't provide an opportunity to obtain status code value asint. Usingexchange()method is safe with unknown status codes, but the raw status code value couldn't be obtained without reflexion. In 5.0.6 the methodgetRawStatusCode()was introduced inClientHttpResponse(see No support for non-standard HTTP status codes in reactive ClientHttpResponse [SPR-16748] #21289).DefaultClientResponse(default implementation ofClientResponse) wrapsClientHttpResponse, so the status code can be obtained by introducing new method in reactiveClientResponseinterface.It's not possible to use
retrieve()with unknown status codes because it always throwsIllegalArgumentException:That's because the default implementation uses error handling based on
HttpStatusenum value. It would be a good idea to use raw status value instead and provide an opportunity to register error handlers based on raw status code value.I've submited PR 1829 which is going to resolve these issues.
Affects: 5.0.6
Issue Links:
Referenced from: pull request #1829, and commits 038af9a