[whatwg/fetch] Determining MIME type of Request and Response objects (#1135)

In https://bugzilla.mozilla.org/show_bug.cgi?id=1684634 @evilpie found a discrepancy between Wasm's API and Fetch's API in how MIME types are determined for `Request` and `Response` objects.

https://webassembly.github.io/spec/web-api/#compile-a-potential-webassembly-response extracts a MIME type from the response directly, whereas Fetch uses the MIME type field. The MIME type field is not updated however when headers are set after the creation of the `Request` or `Response` object. I suggest we remove the MIME type field and always take changes to headers into account. The easiest change would be to change the MIME type field to a "get the MIME type" algorithm that both `Response` and `Request` define as extracting the MIME type from their current headers. Other suggestions welcome.

https://github.com/web-platform-tests/wpt/pull/27100 has some tests for this. Note that currently all implementations cache the MIME type so all would need to make changes, but it would make the overall situation more consistent and logical.

@youennf @cdumez @ricea @domenic does that seem reasonable?

-- 
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/1135

Received on Friday, 8 January 2021 12:39:52 UTC