cloudflare / cloudflare/workerd
If pedantic_wpt is set, make sure statusText is only set when the fetch spec says so
- Dominant language
- C++
- Stars
- 8.7k
- Forks
- 739
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 174
Description
Although it would seem logical that statusText should be set to match the status code (like "Bad Request" or "Method Not Allowed"), this is not what the WHATWG fetch spec says:
> A [response](https://fetch.spec.whatwg.org/#concept-response) has an associated status message. Unless stated otherwise it is the empty byte sequence.
[fetch.spec.whatwg.org#concept-response-status-message](https://fetch.spec.whatwg.org/#concept-response-status-message)
We do have to set it for data, blob and about URLs though. For example,
> 4.2. Scheme fetch
> 3. Switch on request’s [current URL](https://fetch.spec.whatwg.org/#concept-request-current-url)’s [scheme](https://url.spec.whatwg.org/#concept-url-scheme) and run the associated steps:
> "blob"
> 13. If request’s [header list](https://fetch.spec.whatwg.org/#concept-request-header-list) [does not contain](https://fetch.spec.whatwg.org/#header-list-contains) `Range`:
> 2. Set response’s [status message](https://fetch.spec.whatwg.org/#concept-response-status-message) to `OK`.
> 14. Otherwise:
> 14. Set response’s [status message](https://fetch.spec.whatwg.org/#concept-response-status-message) to `Partial Content`.
I started working on this in #3963 but we can't do it without the `pedantic_wpt` flag as this is technically a backwards-incompatible change.
Contributor guide
Assessment
This issue has not been assessed yet.