[whatwg/fetch] Response `statusText` is ambiguous and unclear for HTTP/2 (#599)

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](https://tools.ietf.org/html/rfc7540#section-8.1.2.4)

> 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.

```js
fetch("/").then((r) => console.log(r.statusText)); // 200
```

* Chrome: `""`
* Firefox: `"OK"`
* Safari: `"HTTP/2.0 200"`

```js
fetch("/doesnotexistasdf").then((r) => console.log(r.statusText)); // 404
```

* Chrome: `""`
* Firefox: `"Not Found"`
* Safari: `"HTTP/2.0 404"`


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/599

Received on Wednesday, 6 September 2017 23:11:01 UTC