Skip to content
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

Improve message for HttpStatusCodeException with empty status text #22162

Closed
spring-projects-issues opened this issue Dec 29, 2018 · 2 comments
Closed
Assignees
Labels
in: web type: enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Dec 29, 2018

Jerzy Krolak opened SPR-17631 and commented

I noticed that in RestTemplate-based client, I'm getting error messages like 404 null and similar. Then I found that the Spring Boot application returns error statuses like the following:

> curl -v http://localhost:8080/page-not-found
(...)
< HTTP/1.1 404
< Content-Type: application/json;charset=UTF-8

which will look like this:

org.springframework.web.client.HttpClientErrorException$NotFound: 404 null

Others return results like:

curl -v http://google.com/page-not-found
(...)
< HTTP/1.1 404 Not Found
< Content-Type: text/html; charset=UTF-8

Which results in a nice looking error message:

org.springframework.web.client.HttpClientErrorException$NotFound: 404 Not Found

I'm not sure if I should raise is as a bug - it does not seem that the status message is mandatory.

Is this a bug, or a feature?


Affects: 5.1.3

Issue Links:

  • #19967 Exception hierarchy under HttpClientException and HttpServerException for the RestTemplate
@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Dec 29, 2018

@spring-projects-issues spring-projects-issues added type: bug status: waiting-for-triage in: web and removed type: bug labels Jan 11, 2019
@poutsma poutsma self-assigned this Jan 23, 2019
@poutsma poutsma added type: enhancement and removed status: waiting-for-triage labels Jan 23, 2019
@poutsma poutsma changed the title HTTP error 404 from spring web causes "404 null" message in RestTemplate [SPR-17631] Improve message for HttpStatusCodeException with null status text Jan 23, 2019
@poutsma poutsma changed the title Improve message for HttpStatusCodeException with null status text Improve message for HttpStatusCodeException with empty status text Jan 23, 2019
@poutsma poutsma added this to the 5.2 RC1 milestone Jan 23, 2019
@poutsma
Copy link
Contributor

@poutsma poutsma commented Jan 23, 2019

Thanks for providing a test case!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web type: enhancement
Projects
None yet
Development

No branches or pull requests

2 participants