Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
RestTemplate throws IllegalArgumentException when HTTP status is not in the HttpStatus enum [SPR-6752] #11418
Using RestTemplate to connect to a server that occasionally throws HTTP Status of 420, I am getting IllegalArgumentExceptions when accessing the HttpStatus object in my implementation of the ResponseErrorHandler interface. When I removed that, and started pulling the status from the Headers directly, RestTemplate started throwing errors due to the logger.warn call in RestTemplate.handleResponseError(). I've gotten around this by not using the HttpStatus enum (getting status from the HttpHeaders directly) and by turning up the log level for RestTemplate to ERROR. Shouldn't this support any HTTP status value?
Affects: 3.0 GA
Referenced from: commits 68b4c7d
Backported to: 3.0.1
Wallace Wadge commented
I think this bug should be reopened for there is no way to manually get the raw code. I'm currently running into the same problem due to receiving status 308 (this comes from google's document list api: http://code.google.com/apis/documents/docs/3.0/developers_guide_protocol.html).
Just exposing the raw statusline/status code should be sufficient.