Skip to content

HttpClientErrorException should provide access to response headers [SPR-7938] #12593

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

Closed
spring-projects-issues opened this issue Feb 3, 2011 · 6 comments
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Feb 3, 2011

Julian Reschke opened SPR-7938 and commented

It would be good if HttpClientErrorException would not only provide access to the response body but also to response headers,


Sub-tasks:

Referenced from: commits bca2357, c471bdd, b992c3d

2 votes, 5 watchers

@spring-projects-issues
Copy link
Collaborator Author

Arjen Poutsma commented

Moved to SPR.

@spring-projects-issues
Copy link
Collaborator Author

Scott Andrews commented

#86

@spring-projects-issues
Copy link
Collaborator Author

Dave Syer commented

I'm not sure if anyone tested this in a live system, but there is likely to be a nasty problem waiting for anyone using it out of the box. I think that the default implementation of HttpClientResponse (the JDK one) barfs if you try and get the headers from an error response, or even a non-OK one in my experience. It might be a good idea to be defensive about this line:

HttpHeaders headers = response.getHeaders();

Wrap it in a try/catch or something?

@spring-projects-issues
Copy link
Collaborator Author

Chris Beams commented

Thanks for the heads-up, Dave. Scott, can you follow up and look into this?

@spring-projects-issues
Copy link
Collaborator Author

Scott Andrews commented

@Dave The change set didn't change the semantics on when or how the HttpHeaders are accessed. If there is an issue, it a preexisting bug.

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Jun 4, 2012

Rossen Stoyanchev commented

If I'm not mistaken the issue is specifically for a 401 response? #14004

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant