Skip to content

DefaultResponseErrorHandler wastes the body of a response with an unknown status [SPR-16604] #21145

Closed
@spring-projects-issues

Description

@spring-projects-issues

Milos Cubrilo opened SPR-16604 and commented

RestTemplate.handleResponse calls ResponseErrorHandler.hasError(response) to check if it should delegate error handling to ResponseErrorHandler instance.

In case of an unknown status code, DefaultResponseErrorHandler.hasError swallows the exception thrown by DefaultResponseErrorHandler.getHttpStatusCode(response) and returns false.

This causes RestTemplate code to proceed with standard response handling, but without possibility to read message body, which has already been consumed during UnknownHttpStatusCodeException creation in DefaultResponseErrorHandler.getHttpStatusCode(response) call.


Affects: 4.3.14

Issue Links:

Referenced from: pull request #1742, and commits 3b3f27d, d95bbb6

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions