Skip to content

Improve message for HttpStatusCodeException with empty status text #22162

Closed

Description

@spring-projects-issues

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:

Activity

  1. added
    type: bug
    status: waiting-for-triage
    in: web
    and removed
    type: bug
    on Jan 11, 2019
  2. self-assigned this
    on Jan 23, 2019
  3. added
    type: enhancement
    and removed
    status: waiting-for-triage
    on Jan 23, 2019
  4. 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[/+] on Jan 23, 2019
  5. changed the title [-]Improve message for `HttpStatusCodeException` with null status text[/-] [+]Improve message for `HttpStatusCodeException` with empty status text[/+] on Jan 23, 2019
  6. added this to the 5.2 RC1 milestone on Jan 23, 2019
  7. poutsma commented on Jan 23, 2019

    @poutsma
    Contributor

    Thanks for providing a test case!

  8. added a commit that references this issue on Sep 17, 2026
    a5cef38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: webtype: enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions