-
Notifications
You must be signed in to change notification settings - Fork 38.4k
RestTemplate doesn't consistently tolerate unknown HTTP status codes [SPR-15978] #20529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Juergen Hoeller commented I've extended the scope of this issue a bit since it's not just |
Darija Radchenko commented Maybe I can configure RestTemplate to use some body extractor that will let me avoid these errors? |
Juergen Hoeller commented I've done a full revision of the affected code for 5.0 (introducing a lenient |
Darija Radchenko commented Thank you very much! I tested it on a Spring 5 and it works without any additional configuration. Cheers! |
Patrik Steuer commented Will this fix be available for 4.3.1x aswell? |
Juergen Hoeller commented This should work fine in 4.3.12 already. Have you encountered any recent issues there? |
Patrik Steuer commented It didn't work for me. The related DefaultResponseErrorHandler in the relaese tag does also not contain your change, atleast what I see on github https://github.com/spring-projects/spring-framework/blob/85aab388f0a8f3464fb85030faf45e3deb22a094/spring-web/src/main/java/org/springframework/web/client/DefaultResponseErrorHandler.java |
Juergen Hoeller commented Ouch, indeed. The backport included the Could you please create a separate JIRA issue for this? I'll sort it out for 4.3.13 then. |
Juergen Hoeller commented I've created #20656 myself, specifically for |
Anika Solanka commented Hi, I'm using version 4.3.13 and it seems that the ResponseEntityResponseExtractor in this version also has a problem with unknown HTTP status codes. It is calling response.getStatusCode() which throws IllegalArgumentException for unknown status codes. |
Juergen Hoeller commented Anika Solanka, indeed, this looks like one more case that we need to backport to 4.3.x there. This seems to work fine in 5.0.2, so let's simply backport that |
Anika Solanka commented
|
Darija Radchenko opened SPR-15978 and commented
I'm really sorry, I fill confused about this, but as listed here we are enable to handle custom http status codes already... But I'm still getting
IllegalArgumentException: no matching constant for [230]
caused inMessageBodyClientHttpResponseWrapper.hasEmptyMessageBody()
.I'm using API that responses 230, 240 codes etc... Can you please provide some example or guide me somewhere I can find the solution?
Spring Framework version 4.3.11
Affects: 4.3.11
Issue Links:
Referenced from: commits 4cbef27, 038af9a, 18a3322
Backported to: 4.3.12
The text was updated successfully, but these errors were encountered: