Skip to content

Response statusText is ambiguous and unclear for HTTP/2 #599

@JosephPecoraro

Description

@JosephPecoraro

The statusText property of Response is unclear for HTTP/2.

HTTP/2 does not include a status message / reason like HTTP/1.1: RFC 7540

8.1.2.4. Response Pseudo-Header Fields
...
HTTP/2 does not define a way to carry the version or reason phrase
that is included in an HTTP/1.1 status line.

The Fetch spec simply defines statusText as the status message value, which unless otherwise specified is OK.

For HTTP/2 it seems status message could be interpreted any number of ways:

  • empty string - because there is no reason phrase
  • "OK" - because that is always the default (would be weird to have a 404 OK though)
  • implementation defined - such as some default reason text for a status code

Different browser behaviors. Test on an HTTP/2 capable domain.

fetch("/").then((r) => console.log(r.statusText)); // 200
  • Chrome: ""
  • Firefox: "OK"
  • Safari: "HTTP/2.0 200"
fetch("/doesnotexistasdf").then((r) => console.log(r.statusText)); // 404
  • Chrome: ""
  • Firefox: "Not Found"
  • Safari: "HTTP/2.0 404"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions